WPMu Development for Education

Making WPMU work in education, one hack at a time

Archive for September, 2009

New BuddyPress / bbPress plugin: Group Forum Subscription

Posted by boone on 30th September 2009

BuddyPress and bbPress can be plugged into each other such that BuddyPress groups get their own discussion forums, which are powered by bbPress. Adding Burt Adsit’s bpGroups means that private and hidden groups can have their discussion forums private too. But a major hurdle is email notification: Certain kinds of BP communities simply won’t get rolling if there’s no easy way for users to get email notification of new discussions. There are solutions out there to assuage this problem within bbPress (notably Thomas Klaiber’s Post Notification, which served as the inspiration for the mechanics of my own plugin), but email notification remains hidden in bbPress favorites, instead of in an out-front toggle.

Group forum notification is coming in a future version of BuddyPress, but it’s important enough that I needed it now.

This set of plugins, called Group Forum Subscription, fixes that. Features:

  • Users can subscribe to individual discussion topics from within BuddyPress
  • Users can subscribe to topics on a group-by-group basis – that is, one can subscribe to all existing and future topics associated with a particular BuddyPress group
  • Users are automatically unsubscribed from a group’s discussions when they leave the group
  • Administrators can subscribe all users to the appropriate forums with a single click (potentially handy for first-time setup
  • Administrators can toggle whether email notification is turned on by default.
  • Administrators can determine whether the topic links in the notification emails will point to bbPress or to the BuddyPress forum interface

Installation instructions

  1. Download the package
  2. Upload the BuddyPress plugin bp-group-forum-subscription.php to the plugins directory of your main WPMU blog and activate it
  3. If you prefer for the members of your community to use the BuddyPress posting interface for discussions, add the following hook:
    <?php do_action( 'groups_forum_topic_custom_content' ); ?>

    immediately after

    <div class="info-group">

    in /[your bp theme dir]/groups/forums/topic.php

  4. If you plan for your users to use bbPress for forum reading and posting, upload the bbPress trigger plugin bb-group-forum-subscription.php to [bbpress-install-dir]/my-plugins/ and activate it through the bbPress admin screen. Please note: the bbPress plugin changes the (IMO somewhat opaque) “Add to favorites” link on each topic page to a more straightforward Subscribe/Unsubscribe. If you like this change, open up [bbPress-theme-dir]/topic.php, and change
    user_favorites_link();

    to

    user_favorites_link( array('mid' => __('Subscribe to this discussion')),array('mid' => __('Unsubscribe from this discussion')));

You can configure the plugin on the admin page (Group Forum Subscription under Dashboard Settings. Members of your BP community can tinker with their subscriptions either on the individual topic pages (in bp or bbpress) or on their BP Settings > Notification page (where they can subscribe/unsubscribe to entire groups).

I’m in the process of setting up BuddyPress 1.1, which was just released today. Once I’ve got a dev instance of it up and running, I will do the necessary fixes to make the plugin run on the new version. (I don’t think it will be too hard, given the number of craptastic workarounds I had to do in this version because of the absence of all the nice 1.1 hooks.) Stay tuned.

Related posts:

  1. New BuddyPress plugin: Enhanced BuddyPress Widgets
  2. WPMU 2.8, bbPress and cookie problems solved
  3. Removing previous comment edits from BuddyPress activity – a plugin

Posted in BuddyPress, WordPress, bbPress, dev.wpmued, edtech, groups, plugin, wpmu | Comments Off

Fixing WPMU 2.8.4 and the ignored Banned Email Domains option

Posted by dnorman on 30th September 2009

wpmufunctions_iconI’ve been having a heck of a time battling sploggers at UCalgaryBlogs.ca – roaches that create accounts and blogs so they can foist their spam links to game Google (thanks for providing spammers with such a powerful incentive, Google).

There’s an option in WordPress Multiuser to ban email domains – provide the domains, one per line, into a text box, and it will reject any roaches trying to create accounts from those domains.

The biggest offenders have been myspace.info and myspacee.info – and although they’ve been in my Banned Email Domains list for months, they just keep getting through. I figured there was some exploit they were using, but couldn’t find a thing.

So, today, I took a look through the code of WPMU 2.8.4, to see if I could find what was going on. Turns out, it’s a really simple fix. There’s a function in wp-includes/wpmu-functions.php, called is_email_address_unsafe() – it’s supposed to check the contents of the Banned Email Domains option field, and reject addresses from the flagged domains.

Except it wasn’t. Rejecting, I mean. It was letting everyone through, because of a simple bug in the code. It was written to treat the value of the option as an array and to directly walk through each item of the array. But, the option is stored as a string, so it needs to be converted to an array first. Easy peasy. Here’s my updated is_email_address_unsafe() function, which goes around line 880 of wpmu-functions.php:

function is_email_address_unsafe( $user_email ) {
    $banned_names_text = get_site_option( "banned_email_domains" ); // grab the string first
    $banned_names = explode("\n", $banned_names_text); // convert the raw text string to an array with an item per line
    if ( is_array( $banned_names ) && empty( $banned_names ) == false ) {
        $email_domain = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) );
        foreach( (array) $banned_names as $banned_domain ) {
            if( $banned_domain == '' )
                continue;
            if (
                strstr( $email_domain, $banned_domain ) ||
                (
                    strstr( $banned_domain, '/' ) &&
                    preg_match( $banned_domain, $email_domain )
                )
            )
            return true;
        }
    }
    return false;
}

The fix is in the first 2 lines of the function – getting the value of the string, and then exploding that into the array which is then used by the rest of the function. I’ve tested the updated function out on UCalgaryBlogs.ca and it seems to work just fine. Hopefully the fix will get pulled into the next update of WPMU so everyone with Banned Email Domains can breathe a bit more easily.

Posted in PHP, WordPress, bug, code, general, wpmu | Comments Off

Google Wave coming

Posted by Reverend on 30th September 2009

Have you caught the buzz on Google Wave?  It is open source.  The promise is it will make you forget it is running in a browser.  It is all about web-based communication and collaboration.  It is the brain child of the Google Maps creators.  It is not in general release yet, but  you can see a demo.  Very promising — I particularly like the more open approach.

Google Wave Preview

Google Wave is a new tool for communication and collaboration on the web, coming later this year. Watch the demo video below, sign up for updates and learn more about how to develop with Google Wave.

Google’s Much-Anticipated Wave Opens Up a Bit – Bits Blog – NYTimes.com

But so far, Wave, a shared online desktop where groups of users can exchange messages, share and edit documents, drag and drop widgets and play games, has been available only to a select group of developers. On Tuesday, Google is rolling out Wave to a slightly-less-select group: 100,000 users, including developers, people who signed up early on and some users of Google Apps, the company’s package of online applications.

Google Wave Preview

Google Wave uses an open protocol, so anyone can build their own wave system.  Learn more at www.waveprotocol.org.

Google Wave API – Google Code

The Google Wave API allows developers to use and enhance Google Wave through two primary types of development:

* Extensions: Build robot extensions to automate common tasks or build gadget extensions to provide a new way for users to interact
* Embed: Make your site more collaborative by dropping in a Wave

Posted in Open Source, PLE, Technology, Web, application, applications, blog, games, rss, video | Comments Off

Firefox add-on recommendatons for educaton

Posted by Reverend on 30th September 2009

I received an email contact from Onlinecourses.org mentioning their latest post on Firefox Add-ons. I’m a bit of a Firefox add-on addict so I always enjoy seeing which ones someone else highlights.  Their list includes my all time favorite, ScribeFire — a tool for easy posting to a blog right from Firefox.

I do find it a little suspicious when a site is mysterious (perhaps unintentionally) regarding its purpose and management.  The OnlineCourses site doesn’t list any organization address, and their about and contact-us pages aren’t very helpful either.  Who are they, and what is their motivation?  The content of the site overall looks helpful, with no banner ads or other spam-type stuff going on.  So they don’t look suspicious.  But as a skeptic I always like to be able to put an actual real-world identify to a web site.  You can never be too careful — and this is the type of informed consumer-behavior we need to be ingraining into our students.

99 Awesome Firefox Add-ons for Educators – Online Courses

They say today’s educators are overworked and underpaid. Luckily, the web offers tools to make your professional life more manageable and less stressful. These add-ons might not change your salary, but we’re sure they’ll ease your workload.

Posted in Firefox, Learn, Web, blog, content, email, management, student, students | Comments Off

Internet Explorer 8 excuses — not a solution

Posted by Reverend on 30th September 2009

Do you maintain a web-based application, with a recent rise in end-user issues.  Does it feel like thay are all running Internet Explorer 8?  I’m not the most virtuous or precise programmer, but in a couple of recent situations I’ve made the extra effort to get IE8 working.  And in each case the problem was mine — helped along by a forgiving Firefox browser.  Here are a couple of solutions I’ve found helpful.  

As far as WordPress is concerned I’ve had no troubles, although one of our departments is currently struggling with a WordPress MU editor quirk — they can’t publish a new post, but can re-open it and publish it on the 2nd try.  They are working pretty hard to try to identify what is causing the problem (and any ideas will be most welcome!).  But in another case, with another web app, in another department, one of our users was recently told “oh yes, IE8 doesn’t work properly — can’t you use Firfox instead?”  Isn’t that a cop-out?  An excuse for some bit of bad coding that has been lurking in the background?  Yes, it is a pain, but I don’t think it is really fair to blame Microsoft for everything that goes wrong. 

Using the IE8 X-UA Compatibility Meta Tag Properly « Martin Ivanov

1. Add the following meta-tag in the head section of your webpage above any linked files (i.e, above … and tags)  If the tag is below link or script tags, the fix will not work.

AJAX with IE8 – returns error c00ce56e

Although I’ve been having this problem for a while I always end up solving the problem right after I post the problem.
edit /etc/php/php.ini and change – default_charset = “UTF-8″ – IE seemed to be very picky about it. works with FF too.

Google said it created Chrome Frame because Internet Explorer, especially in its older versions which are still common on millions of PCs, are not suited to running complex Web applications like Google Wave. Google’s plan is that developers of complex apps, including itself, will add a line of code to those programs telling users that they need the Chrome Frame plug-in to run them, thereby making an end run around Internet Explorer.

Posted in PHP, Technology, Web, WordPress | Comments Off

Then there is BuddyPress on UMW Blogs

Posted by Reverend on 30th September 2009

…and oh what a beautiful thing it is.  We made no special announcement, and we have kept the profile data to a bare minimum, and Martha just pulled the whole thing together with the awesome new theme (and who’s work shows no fear!). And I have to say I love the visual integration with BuddyPress, the entire space now integrates so beautifully  and makes a huge difference. I’m interested to see if and how people find and discover one another through the blogs directory.  When I just opened it up, I saw a number of cools blogs, our Strategic Planning site (another brilliant Martha Burtis design being stewarded beautifully by Nina Mikhalevsky out in the open), Tim O’Donnell’s and Jeff McClurken’s Ted Seminar is a featured blog, and Theresa Grana’s Bioinformatics syndicated Lab and Learning notebooks is front and center. It is another way at this community, and it opens up all kinds of possibilities for serendipity.

Blogs Directory

I find myself using the members directory to search known users and find new ones, I also use it as a kind of trace of who’s on now.  And when I see an old friend, I friend them :)

Members Directory

The Groups directory is something I am thinking a lot more about.  No one has used it really, but in the Looking for Whitman experiment, faculty are using it to direct message/email the entire class, and it works.  It is also wold be interesting, as Martha pointed out, to experiment with a class forming a group, which immediuately spawns a blog that they can use to author, or simple work within the forum/wire of the group.  What if groups had more of a twitter design for members, and allowed that conversations throughout the site in these unique groups, but then re-aggregated all together? Maybe, or maybe not.  We’ll see.

Groups Directory

Finally, the Profile page template is undergoing a much needed simplification, and it can be that very dashboard Gardner has talked about again and again, but something that show you your comments, blogs, friends, and various other things that allow you to frame an aggregated identity across the site.

Profile Page

Only time will tell, but I see the BuddyPress suite of features building in a rich means to explore the community that didn’t exist for WPMu before, and that in many ways brings some important sinews of connection between people into the architecture.  Grafting that on top of thousands of blogs asn users opens up a space to see if and how people use it, and how might we be able to make it further illustrate the work that is going on throughout UMW Blogs.

Posted in BuddyPress, UMW Blogs, WordPress, devwpmued, umwblogs, wordpress multi-user, wpmu, wpmued | Comments Off

Option Arrays

Posted by Ron on 29th September 2009

In the Top 10 Most Common Coding Mistakes in WordPress Plugins, third on Ozh’s list is “3. What? 87 new rows in the option table?”. In any of the plugins (and themes) I’ve looked at that use the built-in option saving functionality each field on the options page is being saved as a separate record in the options table.

These option pages can be written to save the plugin options as an array in a single record in the options table. This post is really a Part II to yesterday’s post, so I I’m going to use the Facebook Dashboard Widget options page for code samples.

In yesterday’s post I added a function that defined a whitelist array. For reference, here is the array:

$added = array( 'fdw_options' => array( 'fdw_showupdates',
'fdw_updatesfeed',
'fdw_updatesmax',
'fdw_updatesheight',
'fdw_updatesnewheight',
'fdw_updateswidth',
'fdw_shownotifications',
'fdw_notificationsfeed',
'fdw_notificationsmax',
'fdw_notificationsheight',
'fdw_notificationsnewheight',
'fdw_notificationswidth',
'fdw_showposted',
'fdw_postedfeed',
'fdw_postedmax',
'fdw_postedheight',
'fdw_postednewheight',
'fdw_postedwidth')
);

For each of the elements of the value array ( ‘fdw_showupdates’, ‘fdw_updatesfeed’, etc.) there is a corresponding field on the option form:


<select name="fdw_showupdates">
<option value="no"<?php if ( $fdw->updates_show == "no" ) { echo ' selected="selected"'; } ?>>No</option>
<option value="yes"<?php if ( $fdw->updates_show == "yes" ) { echo ' selected="selected"'; } ?>>Yes</option>
</select>

To implement as an array we need to come up with an option name. The one I chose was fb_dash_widget. To convert the field to be saved in that array I changed the name attribute to fd_dash_widget[showupdates]:


<select name="fd_dash_widget[showupdates]“>
<option value=”no”<?php if ( $fdw->updates_show == “no” ) { echo ‘ selected=”selected”‘; } ?>>No</option>
<option value=”yes”<?php if ( $fdw->updates_show == “yes” ) { echo ‘ selected=”selected”‘; } ?>>Yes</option>
</select>

If all of the controls on the option form are named fd_dash_widget[unique_element_name] they will be posted by the browser as an element in the fd_dash_widget array. Once I made that change with all of the option fields on the form I updated the whitelist filter that I added yesterday:


function fdw_whitelist($options) {
$added = array( 'fdw_options' => array( 'fb_dash_widget' ) );
$options = add_option_whitelist( $added, $options );
return $options;
}
add_filter('whitelist_options', 'fdw_whitelist');

I haven’t had a chance to test it, but I expect a similar strategy could be used with theme options pages. A final note is that Chris, the author of the Facebook Dashboard Widget, left me a comment. So, I’ve been in contact with him and will be sending my revisions to him. At some point in the coming weeks, he should be releasing a new version.

 


© ahome for WPMU Tutorials, 2009. |
Permalink |
No comment |
Add to
del.icio.us


Post tags: , , , ,

Need real genuine helpful support? MU Support.

Feed enhanced by Better Feed from Ozh

Posted in WordPress, how to, plugins, wordpress mu, wpmu | Comments Off

Writing Plugins (for WP WPMU)

Posted by Ron on 28th September 2009

All of our children have a blog on one of our WPMU installs. One of them asked Andrea if we could add a facebook plugin so she could follow her facebook stream from her blog. The plugin that Andrea found that she thought would do the trick was the Facebook Dashboard Widget.

After Andrea installed the plugin, our daughter tried it out and found that the options page would not save any settings. I’ve fixed that issue in a few WP plugins in the last few months. It is a fairly straight forward process:

Search through the plugin code and look for functions being added to the the admin_menu hook. In this plugin it was around line 640:

add_action('admin_menu', 'fdw_menus');

Now, I needed to find the fdw_menus function. In this case, it was right above the hook:

function fdw_menus() {
if (current_user_can('manage_options')) {
if (function_exists('add_options_page')) {
add_options_page(__('Facebook Dashboard Widget', 'fdw'), __('Facebook Dashboard Widget', 'fdw'), 8, __FILE__, 'fdw_options');
}
}
}

What I was looking for in that function was the function name that WP/WPMU calls for the admin page. In this case it’s fdw_options. That function can be found at about line 385. The first few lines are

function fdw_options() {
global $fdw;
?>
<div class="wrap">
<form method="post" action="options.php" style="margin-bottom: 60px;">
<h2><?php echo __('Facebook Dashboard Widget Options', 'fdw') ?></h2>
<?php wp_nonce_field('update-options') ?>

There are two changes that I made in this code. I commented out the call to wp_nonce_field (It’s okay to completely remove it because the settings_field that I mention next adds its own wp_nonce_field). And, I added a call to settings_fields passing the name of the option page function as a parameter:

function fdw_options() {
global $fdw;
?>
<div class="wrap">
<form method="post" action="options.php" style="margin-bottom: 60px;">
<?php settings_fields('fdw_options'); ?>
<h2><?php echo __('Facebook Dashboard Widget Options', 'fdw') ?></h2>
<?php //wp_nonce_field('update-options') ?>

There’s another change that needs to be made. For this part, I looked through the form HTML of the options page for hidden element called page_options. I found it at about line 590:


What I needed from this is the comma separated list that is the page_options’ value (fdw_showupdates, fdw_updatesfeed, …). I used that list in a new function that I added to the bottom of the plugin:

function fdw_whitelist($options) {
$added = array( 'fdw_options' => array( 'fdw_showupdates',
'fdw_updatesfeed',
'fdw_updatesmax',
'fdw_updatesheight',
'fdw_updatesnewheight',
'fdw_updateswidth',
'fdw_shownotifications',
'fdw_notificationsfeed',
'fdw_notificationsmax',
'fdw_notificationsheight',
'fdw_notificationsnewheight',
'fdw_notificationswidth',
'fdw_showposted',
'fdw_postedfeed',
'fdw_postedmax',
'fdw_postedheight',
'fdw_postednewheight',
'fdw_postedwidth', )
);
$options = add_option_whitelist( $added, $options );
return $options;
}

The $options parameter to the function is an array where the array key of each element is the name of the option page that the element applies to. The form in this plugin is fdw_options. The value of the array element is an array of option fields on the option page. So, I just converted the comma separated list into an array of values. The call to add_option_whitelist merges the $options parameter and the array I just created.

The last thing to do is hook my function into WP/WPMU. The filter for this is whitelist_options

add_filter('whitelist_options', 'fdw_whitelist');

After those changes the plugin works in both WordPress and WordPress MU (only tested with 2.8.X).

 


© ahome for WPMU Tutorials, 2009. |
Permalink |
No comment |
Add to
del.icio.us


Post tags: , , , , ,

Need real genuine helpful support? MU Support.

Feed enhanced by Better Feed from Ozh

Posted in WordPress, how to, plugins, wordpress mu, wp-wmpu merge, wpmu | Comments Off

Taming FAVICONS

Posted by Reverend on 28th September 2009

What is a favicon? No not something from the Transformers universeAccording to Wikipedia “A favicon (short for favorites icon), also known as a website icon, shortcut icon, url icon, or bookmark icon is a 16×16, 32×32 or 64×64 pixel square icon associated with a particular website or webpage” – wikipedia.  But it is also fun — and easy to create utilizing Photoshop or other graphics programs.  All the best-dressed web sites have one.  In helping someone get up and started with the ICO format I came across this really helpful free photoshop plug-in.  If you are favicon-challenged give it a try.

Telegraphics – Free plugins for Photoshop & Illustrator…and other software

ICO (Windows Icon) Format
An easy way to create your web site’s favourites/shortcut/bookmark icon in Photoshop (all versions including CS and CS2), Elements or Paint Shop Pro (v9 recommended). More info. FREE, $5 donation suggested if you love the plugin. (MacHouse has a video tutorial on making a favicon.)

MacHouse – A World of Video Tutorials » Blog Archive » How to Create Fav Icons

This VTC quickly shows how to make fav icons (or favorite icons), which often appear before the URL when you connect a site with an Internet browser. We use Adobe Photoshop and a donationware plugin by telegraphics that is available for Macs and Windows.

Related Posts

Posted in Design, Web, adobe, blog, photo, plugin, plugins, video | Comments Off

Mobile in Museums resource web site

Posted by Reverend on 28th September 2009

George Mason University’s Center for History and New Media has a new resource site on the use of mobile technologies in reaching museum visitors.  The site itself is well done, and a great starting place for any cultural organization.  As with many of the CHNM projects, their program examples are all open source, based on their wonderful Omeka project.  They stress the importance of cross-platform solutions, and the reuse of content in multiple delivery formats (traditional web, mobile, etc.).  And lest we forget the audiences, they stress the importance of meaningful engagement.  The site encourages museums to experiment with mobile, and provides resources to help them get started.

Center for History and New Media » Mobile for Museums

  • This site addresses those needs by proving a brief overview of what is being done in the mobile museum world and offers suggestions based on this research on how to economically provide mobile users with a positive experience with your museum…
  • A primary focus of our implementations has been to extend and utilize pre-existing software frameworks and standards. This approach to mobile development avoids having to start from scratch every time an institution wishes to launch content for mobile, saving valuable resources…
  • To offer a mobile site that rendered similar results in all major mobile browser, we modified a pre-existing Omeka theme, Emiglio…
  • our goal was to create a single development solution that works across three major platforms: Android, Blackberry, and iPhone. We hope to encourage further cross-platform development, which is why we are releasing this open-source code to our prototypes.

Related Posts

Posted in Design, Museum, Open Source, PLE, Web, content, mobile, new media, project | Comments Off