misterbrandt
Forum Replies Created
-
Forum: Plugins
In reply to: Getting user info at wp_login hook?Voodoo – thanks for prodding me in the direction or doing it from scratct, rather than trying to figure out which global variables weren’t available yet, and tracking those dependencies though everything.
In the end, I was able to use get_userdatabylogin() to get a copy of the user object, and then I wrote a custom version of current_user_can() that uses get_option() to pull the roles and capabilities out of the db directly. For anyone else’s future reference, this is how I did it:
function elbe_zp_login( $user_login ) {
$user = get_userdatabylogin($user_login);
if (elbe_current_user_can('publish_posts', $user)) {
elbe_zp_login_user();
} else {
// echo "current user cannot publish posts...";
}
} // end function
function elbe_current_user_can($capability, $current_user) {
//
$roles = get_option('wp_user_roles');
$user_roles = $current_user->wp_capabilities;
$user_roles = array_keys($user_roles, true);
$role = $user_roles[0];
$capabilities = $roles[$role]['capabilities'];
if ( in_array( $capability, array_keys( $capabilities, true) ) ) {
// check array keys of capabilities for match against requested capability
return true;
}
} // end function
Forum: Plugins
In reply to: comments on index pageI just figured out a fix/hack for showing comments on the front page:
https://www.ads-software.com/support/topic/32818#post-218249Forum: Fixing WordPress
In reply to: WP. 1.5 – show comments under postI just figured out a fix/hack for showing comments on the front page in WP 1.5:
https://www.ads-software.com/support/topic/32818#post-218249Forum: Installing WordPress
In reply to: Display comment text on home pageOf course, as soon as I post here, I figured out a hack. I am still open to hearing a less hacky soution from someone though.
I used Eric Meyer’s “MW Comments/Trackbacks” plugin [1] to get acces to the
mw_comments()
function, which I used to populate the$comments
global variable thatcomments.php
pulls from.Example from my theme’s
index.php
:
<div class="entrytext">
<?php the_content('<p class="serif">Read the rest of this entry »'); ?>
<?php
$comments = mw_comments();
include(TEMPLATEPATH . '/comments.php'); // Display comments
?>
</div>
[1] https://www.meyerweb.com/eric/tools/wordpress/mw_comments_trackbacks.html
Hopefully this is clear and stops others from tearing their hair out as badly as i have been doing for the last few days.
Forum: Installing WordPress
In reply to: Display comment text on home page*bump*.
Me too. All the 1.2 instructions do not seem to work for 1.5.