zooney
Forum Replies Created
-
Forum: Plugins
In reply to: [Plugin: Shibboleth] Username at risk of breaking permalinks with %author%…I suppose I should use some other attribute for the username, but I’ve found that adding something like:
if( $shib_headers['username']['name'] == 'eppn' ) { $username = sanitize_title( $username ); }…after line 272 in shibboleth.php (in shibboleth_authenticate_user) is useful in making a friendlier username from the eppn.
So, would it be possible to add a filter for $username, or some other way of modifying the username supplied by the headers before it’s used to actually create the account? It’d be useful to have some control over the form of usernames in wordpress after they’re taken from the Shibboleth headers.
Forum: Plugins
In reply to: [Plugin: Shibboleth] Username at risk of breaking permalinks with %author%@mitcho I apologize for just thinking out loud here, but, I think I see why sanitize_title is a better choice than sanitize_user.
sanitize_user seems to still allow the ‘@’ and ‘.’ characters (I’m assuming for an LDAP-style username) and that character will cause problems with the %author% links.
sanitize_title seems to strip out ‘@’ along with ‘.’ and other characters, which seem to be what’s keeping the %author% links from working.
This is particularly important with shibboleth since EPPNs tend to be of the form username@domain.name
Forum: Plugins
In reply to: [Plugin: Shibboleth] Username at risk of breaking permalinks with %author%@guychisholm Gotcha, actually, I can switch that $force_update parameter in the shibboleth_authenticate_user function, but, the likelyhood that I can get everyone to re-log to make sure they all get fixed is pretty slim. =)
I’ll just run the script.
Incidentally, its essentially impossible to change user_login after it’s been created in WordPress, right? My guess is that wp_update_user can’t touch that.
If so, I wish I had known about these filters before I started using the plugin. =)
Oh well… live and learn.
Forum: Plugins
In reply to: [Plugin: Shibboleth] Username at risk of breaking permalinks with %author%I’m beginning to see the issue here.
I already have a wp_users table with the entire user_nicename column filled in with unsanitized user_nicenames due to using the shibboleth plugin without this filter.
@guychisholm does the filter method you use work when there are pre-existing user accounts?
Also, I’m wondering how this works at all seeing that, given the logic in shibboleth_update_user_data and the structure of the ‘shibboleth_headers’ array, user_nicename will never be updated unless $force_update is true, since it has no ‘managed’ key in the ‘shibboleth_headers’ array.
@mitcho is it possible to suggest as part of an upgrade, the ability to fix previously entered user_nicenames created by the shibboleth plugin? If not I’ll have to run some kind of script on my database myself to clean this up…
Although, thanks to both of you for the huge leg up in finally locating what the issue here actually was… 🙂
Forum: Plugins
In reply to: [Plugin: Shibboleth] Username at risk of breaking permalinks with %author%Woo-hoo! We have a maintainer!
Question though about this fix… does this filter need to be in place prior to the generation of accounts?
…or, are you adding a filter using apply_filters as well?
Any help would be hugely appreciated here! =)
Forum: Fixing WordPress
In reply to: Add links with mms:// or rtsp:// protocolNothin’?
Forum: Plugins
In reply to: Recent Posts Widget with Byline?Hello me,
I think you figured it out thanks to a kind person on WordPress’s bug tracker.
You can extend the Recent Posts widget (its class name is WP_Widget_Recent_Posts) like so:
class RecentPostsWithByline_Widget extends WP_Widget_Recent_Posts { function RecentPostsWithByline_Widget () { $widget_ops = array('classname' => 'widget_recent_entries_with_byline', 'description' => __( "The most recent posts on your site with a byline added") ); $this->WP_Widget('recent-posts-with-byline', __('Recent Posts with Byline'), $widget_ops); $this->alt_option_name = 'widget_recent_entries'; add_action( 'save_post', array(&$this, 'flush_widget_cache') ); add_action( 'deleted_post', array(&$this, 'flush_widget_cache') ); add_action( 'switch_theme', array(&$this, 'flush_widget_cache') ); } function widget( $args, $instance ) { $cache = wp_cache_get('widget_recent_posts', 'widget'); if ( !is_array($cache) ) $cache = array(); if ( isset($cache[$args['widget_id']]) ) { echo $cache[$args['widget_id']]; return; } ob_start(); extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title'], $instance, $this->id_base); if ( !$number = (int) $instance['number'] ) $number = 10; else if ( $number < 1 ) $number = 1; else if ( $number > 15 ) $number = 15; $r = new WP_Query(array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1)); if ($r->have_posts()) : ?> <?php echo $before_widget; ?> <?php if ( $title ) echo $before_title . $title . $after_title; ?> <ul> <?php while ($r->have_posts()) : $r->the_post(); ?> <li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?></a><span class="recent-posts-widget-byline"> by <?php the_author(); ?></span></li> <?php endwhile; ?> </ul> <?php echo $after_widget; ?> <?php // Reset the global $the_post as this query will have stomped on it wp_reset_postdata(); endif; $cache[$args['widget_id']] = ob_get_flush(); wp_cache_set('widget_recent_posts', $cache, 'widget'); } }…if you’re doing so in a plugin, you’ll have to include the default-widgets.php file. For instance, if your plugin is located in a directory in the plugins folder, you’ll need something like this:
include_once ( dirname(__FILE__) . '/../../../wp-includes/default-widgets.php' );…in your plugin file before you attempt to extend the class (so that the WP_Widget_Recent_Posts class will be available and you don’t get a Fatal error: Class ‘WP_Widget_Recent_Posts’ not found in…).
I hope this helps someone out, me. If anything it keeps you from having to rewrite or copy the entire widget.
…that’s… sort of useful, I guess.
Forum: Plugins
In reply to: [Shibboleth] [Plugin: Shibboleth] Plugin updates?Hey there,
I attempted contacting the plugin author, (Will Norris, I think his name is…), about my fix for the following issue:
http://wordpress.org/support/topic/361888?replies=5
…and never got a response.
I’ve been using the Shibboleth plugin with that fix applied on WordPress 3.0 without problems, but, unfortunately I have no idea if this plugin will have continued support or not.
Forum: Plugins
In reply to: [Plugin: Shibboleth] Username at risk of breaking permalinks with %author%Hrrm, do you have a working solution in place for something like this?
It’s something I’ve been looking into myself, I just haven’t had time to devote to it.
I’ve actually just disabled the %author% urls in my theme for the time being.
Forum: Plugins
In reply to: Shibboleth and BuddyPressI talked with the creator of the shibboleth module some time ago and it turned out that this was caused by a bug in BuddyPress that has since been fixed.
Try using the latest version of BuddyPress (1.2.x, I think) and see if it works.
It’s been working for me, except that now I’ve run into the issue that the new version of BuddyPress does not support LDAP-style usernames (i.e. with ‘@’ symbols) properly and that looks as if that’s not a bug they’ll fix until BuddyPress 1.3 according to the ticket I filed:
http://trac.buddypress.org/ticket/2057
Also, even when that gets fixed, the final bit would be to extend the Shibboleth plugin to test for BuddyPress and alter the login forms to be more Shibboleth friendly…
…so, unfortunately, a solution to this will be long in coming. The only thing that I think might hasten the process is to amend the shibboleth module so that usernames could be formed without the ‘@’ symbol (perhaps leveraging wordpress’s “user_nicename” column, I’m not sure).
Forum: Plugins
In reply to: Shibboleth plugin does not hold “Managed” settings…if anyone has been following my general schizophrenic self-dialogues, if you want to fix this problem, you’ll have to go into options-admin.php and change things like :
checked( $shib_headers['first_name']['managed'])to
checked( $shib_headers['first_name']['managed'], 'on' )…and things should be fine.
Forum: Plugins
In reply to: Shibboleth plugin does not hold “Managed” settingsAh, the problem is that __checked_selected_helper is explicitly typecasting the $helper and $current variables…
In 2.8.6 these values weren’t typecast…
Forum: Plugins
In reply to: Shibboleth plugin does not hold “Managed” settings…more accurately, the settings are being saved into the database, but WordPress’s “checked()” function doesn’t seem to be working properly or something…
Forum: Plugins
In reply to: Changing “Leave a Reply” with a plug-inHuh, I think I’m a little closer to figuring this out.
It seems I can to something like:
add_action( ‘comments_template’, some_dumb_function )
To put whatever in there before the comment form spits out.
Oh, but, man, oh, man! WHAT I WOULDN’T GIVE TO BE ABLE TO INSERT THIS CONTENT WITHIN THE COMMENT FORM DIV ITSELF.
WOULDN’T THAT BE GREAT, FOLKS? WOULDN’T THAT COMPLETE YOUR LIFE?
Man, that’d be so freaking awesome if you could do that… Oh geez. It’d be like marmalade on toast.
BITTER marmalade on toast. Buttery, bitter marmalade on dry, stale, stick-in-your-throat kinda toast.
OH WOE AND LAMENT! OH INSUFFERABLE FATE! HOW THE WORLD MOCKS ME!
Endlessly yours,
~Zooney Funglebarten
Forum: Plugins
In reply to: How do you access the media gallery in plugin code…Doink, I’ve answered my own question by studying xen_carousel.
The linchpin in doing something like this is to realize that everything in the media gallery is simply stored in $wbdb->posts with the post_type column set as “attachment”. I’d never realized that’s where everything in the media gallery is stored!
So, to access items in the media gallery in plugin code you simply need to do a query for attachments in the posts table.
To make a clever interface to search and select images and store them as post meta, I’ve found I just need to do some AJAX magic and perform such a query.
Woooo!