Articles

JavaScript and AJAX for Dummies Review

Posted by on Jan 26, 2011 in Articles, Book Reviews | 0 comments

I just finished reading JavaScript and AJAX For Dummies by Andy Harris. I like the Dummies and Idiots books. I think they’re great if you don’t know much about a subject and want to get an introduction to it. I took a course at college about JavaScript ten years ago. Back before jQuery and all that. The knowledge didn’t really stick with me and I’ve always felt uncomfortable using JS and tried to avoid it. I want to be able to use AJAX (which I know nothing about) so I need to update my JS skills. One of the things I like best about this book is that it covers...

Read More

User Types in BuddyPress – Assign xprofile Groups

Posted by on Oct 13, 2010 in Articles, How-To | 16 comments

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...

Read More

Adding User Types to WordPress and BuddyPress – with User Blogs

Posted by on Oct 13, 2010 in Articles, How-To | 6 comments

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(...

Read More

Get Categories Author has Posted in for Custom Post Types

Posted by on Aug 21, 2010 in Articles, How-To | 3 comments

I needed to list all the categories of a custom post type that an author had posted in. I found code to do that with regular posts in the wordpress.org forums and I modified it to use with custom post types. Be sure to replace custom_taxonomy with the name of your taxonomy. Place this into your theme file where you want the list to appear. <?php $author = get_the_author_meta('ID'); $categories = $wpdb->get_results(" SELECT DISTINCT(terms.term_id) as ID, terms.name, terms.slug FROM $wpdb->posts as posts LEFT JOIN $wpdb->term_relationships as relationships ON posts.ID =...

Read More

Limit Number of Posts Per User in WordPress

Posted by on Aug 13, 2010 in How-To | 11 comments

This code will limit the number of posts a user can make. At first, I was trying to limit each user to one post and I had that working. Then I realized that I needed to have different numbers of posts for different users, so I created an option in a user’s profile that only people with the right capability (manage_options) can edit. I’ll be changing this in the future for that number to be automatically changed depending on a user’s subscription type, but I needed this for testing purposes. The option in the profile shows up under the contact info section, which I know is...

Read More

Add User Types to WordPress and BuddyPress

Posted by on Aug 8, 2010 in Articles, How-To | 45 comments

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 been working on some more complicated sites than usual at work. One is a social networking site that uses BuddyPress. It’s my first BuddyPress site, so it’s been a learning experience. Additionaly, it was my first WordPress Multi-Site. One thing I needed to do was allow people to choose a user type at registration. I also needed the user to be assigned a custom Role based on their user type. I...

Read More