BP Profile Search 2.0

November 15th, 2010 andrea No comments

A new version of BP Profile Search, the WordPress / BuddyPress plugin which enables advanced search on the extended member profiles, is ready.

Version 2.0 brings you the following enhancements:

1) Support for multiselectbox and checkbox field types.

Users can select one or more values to search for, and the results are the ones matching any of the values selected.

E.g. if there is a checkbox type field named Preferred Colors with possible values Red, Blue and Green, and users select Red and Green in the search form, they will get all the members with preferred color Red OR preferred color Green.

2) Support for wildcard characters in text searching.

The wildcard characters supported are % (percent sign), matching zero or more characters, and _ (underscore), matching exactly one character.

E.g. read% matches read, reader, readiness and so on, while %read% matches read, bread, reader and so on, and b_each matches breach and bleach, but not beach.

BP Profile Search 2.0 is available for download in the WordPress Plugin Directory and in the BuddyPress Plugin Directory.

Categories: BP Profile Search

Meta links with Menubar 4.9

October 15th, 2010 andrea 18 comments

Do you need to add an item like Log in, Log out, Register, Site Admin to your Menubar menu? Now, with the new PHP item type in Menubar 4.9, you can!

A) Let’s say you wish to add a menu item that lets you logout when you are logged in, and login when you are logged out.

That’s simple. Add to your Menubar menu a new item with type PHP, and enter in the PHP code field the following PHP snippet:

if (is_user_logged_in ())
return array ('Log out', wp_logout_url ());
else
return array ('Log in', wp_login_url ());

That means that, if you are logged in, you’ll get a menu item labeled Log out and pointing to your site logout URL, otherwise you’ll get a menu item labeled Log in and pointing to your site login URL.

B) What if you need a menu item to allow visitors to register to your site? Of course that item should be present only if the visitor is not already logged in.

That’s the content to write into the PHP code field:

if (!is_user_logged_in () && get_option ('users_can_register'))
return array ('Register', site_url ('wp-login.php?action=register', 'login'));
else
return false;

That means that, if the visitor is not logged in and user registration is enabled, you’ll get a menu item labeled Register and pointing to your site signup URL, otherwise you’ll get no menu item at all.

C) Now let’s make a menu item which brings you to the admin dashboard, if you are already logged in.

The code you need to put in the PHP code field is:

if (is_user_logged_in ())
return array ('Site Admin', admin_url ());
else
return false;

That means that, if you are logged in, you’ll get a menu item labeled Site Admin and pointing to your dashboard URL, otherwise you’ll get no menu item at all.

I hope you find these examples useful, and I think they help to show the potential of the PHP item type available in Menubar 4.9. If you find other interesting applications, please share them in the comments!

Categories: WordPress Menubar

Menubar 4.9 is available

October 12th, 2010 andrea No comments

Menubar 4.9 enhances the PHP item type, allowing you to create a menu item and dynamically generate both the link label and the link destination URL.

The PHP item type was introduced in Menubar 4.8, but you could dinamically generate only the link destination, while the link label was specified statically in the Name field.

Now you can enter in the PHP code field any PHP code returning an array with your dynamically generated label and URL; you may also return an empty value, and in this case Menubar will generate no menu item at all.

A sample of the PHP code you can insert in the PHP code field is as follows:

// content of the PHP code field

$someurl = some expression;
$otherurl = other expression;

if (some-condition)
return array ('somelabel', $someurl);
else if (other-condition)
return array ('otherlabel', $otherurl);
else
return false;

This PHP snippet generates:

a) a menu item labeled ‘somelabel’ and pointing to $someurl if (some-condition) is met;
b) a menu item labeled ‘otherlabel’ and pointing to $otherurl if (other-condition) is met;
c) no menu item otherwise.

Menubar 4.9 also fixes a bug that prevented highlighting in an External or PHP menu item type, when the page URL contained a querystring.

Thank you for your support of Menubar!

Categories: WordPress Menubar

Menubar video tutorial

October 8th, 2010 andrea 1 comment

I have just learnt of a great video tutorial covering the installation and use of Menubar, the WordPress plugin that allows you to add configurable menus to your site.

You can find this 13 minute tutorial on Codes Scripts. The author is Patrick Hamy, and he has made a very good job of explaining carefully and clearly all the steps needed to install Menubar and start using it. The tutorial is in French, but I think it’s going to be useful to non French speakers too.

Thank you Patrick!

Categories: WordPress Menubar

Menubar 4.8 released

September 13th, 2010 andrea No comments

This new Menubar version supports a new menu item type, named PHP. With this type you can dynamically generate a menu item using PHP code, so its applications are limited only by your imagination.

You can enter in the URL field any PHP code which returns your dynamically generated URL; you may also return an empty value, and in this case Menubar will generate no menu item at all.

A sample of the PHP code you can insert in the URL field is as follows:

// content of the URL field

$someurl = some expression;
$otherurl = other expression;

if (some-condition)
return $someurl;
else if (other-condition)
return $otherurl;
else
return '';

This PHP snippet generates:

a) a menu item pointing to $someurl if (some-condition) is met;
b) a menu item pointing to $otherurl if (other-condition) is met;
c) no menu item otherwise.

This is only a sample, you can use any PHP code and return the URL you need or no URL at all. Happy menus with Menubar!

Categories: WordPress Menubar