Cleverness – WordPress Resources

To-Do List Plugin Bug Fix v2.2.7

Download To-Do List Plugin v3.1.7Last Updated 05-10-2012

I’m very sorry about the fatal error caused by a missing semi-colon in a file.

This is now fixed in verson 2.2.7. It is a available as a zip file here and should be updated in the WordPress SVN in about fifteen minutes.

Thanks to those who reported the issue.


To-Do List Plugin Updated v2.2.6

Download To-Do List Plugin v3.1.7Last Updated 05-10-2012

* Added value check for assign and priority variables
* Echoing the email values to the screen on failed email sending, for troubleshooting


User Types in BuddyPress – Assign xprofile Groups

As requested by Janis, here is the code I use to show only certain xprofile groups to each user type. In the default BuddyPress theme, profile fields without a value aren’t shown, so only the ones for that group will appear to the public.

You will need to replace a function call in your BuddyPress theme, in /members/single/profile/edit.php. It is at line 12 in mine.

Find

<?php bp_profile_group_tabs(); ?>

And replace it with this:

<?php my_bp_profile_group_tabs(); ?>

In /plugins/bp-custom.php place the following code. You will need to edit it to fit your user type and profile group needs.

function my_bp_profile_group_tabs() {
	global $bp, $group_name;

	$signup_type = get_user_meta($bp->loggedin_user->id, 'signup_type', true);

	if ( !$groups = wp_cache_get( 'xprofile_groups_inc_empty', 'bp' ) ) {
		$groups = BP_XProfile_Group::get( array( 'fetch_fields' => true ) );
		wp_cache_set( 'xprofile_groups_inc_empty', $groups, 'bp' );
	}

	if ( empty( $group_name ) )
		$group_name = bp_profile_group_name(false);

	for ( $i = 0; $i < count($groups); $i++ ) {
	if ( $signup_type == 'usertypea' && ( $groups[$i]->name == 'Base Profile' || $groups[$i]->name == 'Profile Group A' || $groups[$i]->name == 'Profile Group B' ) ) {
		if ( $group_name == $groups[$i]->name ) {
			$selected = ' class="current"';
		} else {
			$selected = '';
		}

		if ( $groups[$i]->fields )
			echo '<li' . $selected . '><a href="' . $bp->displayed_user->domain . $bp->profile->slug . '/edit/group/' . $groups[$i]->id . '">' . attribute_escape( $groups[$i]->name ) . '</a></li>';

	} elseif ( $signup_type == 'usertypeb' && ( $groups[$i]->name == 'Base Profile' || $groups[$i]->name == 'Profile Group C' ) ) {
		if ( $group_name == $groups[$i]->name ) {
			$selected = ' class="current"';
		} else {
			$selected = '';
		}

		if ( $groups[$i]->fields )
			echo '<li' . $selected . '><a href="' . $bp->displayed_user->domain . $bp->profile->slug . '/edit/group/' . $groups[$i]->id . '">' . attribute_escape( $groups[$i]->name ) . '</a></li>';
	} elseif ( $signup_type == 'usertypec' && ( $groups[$i]->name == 'Base Profile' || $groups[$i]->name == 'Profile Group D'  ) ) {
		if ( $group_name == $groups[$i]->name ) {
			$selected = ' class="current"';
		} else {
			$selected = '';
		}

		if ( $groups[$i]->fields )
			echo '<li' . $selected . '><a href="' . $bp->displayed_user->domain . $bp->profile->slug . '/edit/group/' . $groups[$i]->id . '">' . attribute_escape( $groups[$i]->name ) . '</a></li>';
		}
	}

	do_action( 'xprofile_profile_group_tabs' );
}

Adding User Types to WordPress and BuddyPress – with User Blogs

There is a new version of this code located at http://cleverness.org/2011/01/27/updated-buddypress-user-roles-code/. Please use that code and leave all comments on that page.

I’ve previously talked about adding user types to BuddyPress. I’ve found out recently that if you allow new users to create their own blogs, you will need to add the following code to your functions.php file.

function synchro_wp_usermeta_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
	global $bp, $wpdb;

	$type = $meta[signup_type];

	update_usermeta( $user_id, 'signup_type', $type );

}

add_action( 'wpmu_new_blog', 'synchro_wp_usermeta_blog', 10, 6 );

function register_role_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
	global $bp, $wpdb;

   	$userdata = array();
   	$userdata['ID'] = $user_id;
   	$userdata['role'] = $meta['signup_type'];

   	//only allow if user role is my_role

   	if ($userdata['role'] == 'usertypea' || $userdata['role'] == 'usertypeb' || $userdata['role'] == 'usertypec' ){
      	wp_update_user($userdata);
   	}

}

add_action( 'wpmu_new_blog', 'register_role_blog', 101, 6 );

To-Do List v. 2.2.5

The language files were not commited to the SVN properly in yesterday’s version. This version is just to correct that.


To-Do List Plugin v. 2.24

* Removed site title from email subject
* Added ability to change From value for email
* Added French translation by Thibault Guerpillon


To-Do List Plugin v. 2.2.3

Download To-Do List Plugin v3.1.7Last Updated 05-10-2012

This version of the To-Do List plugin had added default values to the assign and progress variables. This is an attempt to fix the problem users on Windows servers have had adding items. I’ve also added success or fail messages to the function that emails the assigned task to a user.


To-Do List Plugin v. 2.2.2

Download To-Do List Plugin v3.1.7Last Updated 05-10-2012

* Added Assign ability to Individual view
* HTML is now allowed in tasks
* Added error message displays for inserting, updating, and deleting items


To-Do List Plugin v. 2.2.1

Download To-Do List Plugin v3.1.7Last Updated 05-10-2012

This update to the To-Do List Plugin includes an updated Spanish translation by Ricardo, a bug fix involving multiple individual lists, and a change to the way the shortcode and widget display individual lists. If a user is logged in, they will see their own list using the shortcode or widget. Non-logged in users currently see all items. I plan to add a setting to the widget soon where you can choose what shows to non-logged in users.

Also, some of the text in the plugin has been reported as being unable to translate. I’ve looked through my code, but can’t see why that’s so. If you have any experience in this matter and want to help, please take a look at the code.


To-Do List Version 2.2

Download To-Do List Plugin v3.1.7Last Updated 05-10-2012

Version 2.2 of the To-Do List Plugin is out.

New in this version are the option to sort by assigned user and the Master list feature.

The Master list can be selected on the settings page under List View. This feature allows you to have one main list that individual users cannot edit, but they can check or uncheck items on it. Changes to the main list affect all users. You only want to give regular users the ability to View and Complete posts, otherwise they will be able to edit the main list.