Search Results for 'code'
-
Search Results
-
It’s not the first time and it won’t be the last. I’m confused.
I’m trying to add forum moderator capabilities to the currently logged in user in a specific forum only. I don’t want to give them the moderator role. I just need to give them additional caps in a specific forum. When the user is tooling ’round in the forum I want to give mod rights to, assign them dynamicly. When they are no longer in that forum, take ’em away on the fly.
If found a couple of things to guide me. One was forum-moderators.php by Aditya Naik. This give specific users a forum moderator role thru the bbpress backend. That stores the rights to those caps as a meta value and assigns them when the user is on the forums. Great. There’s a fn in there that determines what forum the user is in and responds to a filter called ‘bb_user_has_cap’. I can’t find neither hide nor hair of using this filter anywhere except in a couple of plugins by sambauers. http-authentication and ldap-authentication.
So, I found the filter ‘bb_current_user_can’. It looks to me like everyone on the planet is using this filter. The comment in the fn bb_currrent_user_can() says use ‘bb_user_has_cap’. Well, nothing is using that as far as I can determine.
Anyway, my confusion comes in when I try to implement my filter. I’m gonna give the user the following caps:
$forum_mod_caps = array(
'manage_topics' ,
'edit_closed' ,
'edit_deleted' ,
'browse_deleted' ,
'edit_others_tags' ,
'edit_others_topics' ,
'manage_posts' ,
'ignore_edit_lock' ,
'edit_others_posts'
);For me, reading the code for bb_current_user_can() is like the time I got curious about implementing tcp/ip for the Atari ST. I got a headache. My skill level is not up to understanding what is going on down there. Some guidance would be appreciated.
We have 3 args to this filter:
$retvalue, $capability, $argsLooks like $retvalue is being passed up the filter chain. If I don’t want to touch the call I just pass $retvalue back.
I was digging ’round and looks like $capabilities is the cap being queried. $args is specific to each call and may vary depending on what cap is queried.
These are questions in case you haven’t noticed. My understanding breaks down when I get to what I’m being passed and what I’m supposed to do with them other than return ‘true’ if it’s a cap I want to let the user have.
I should just return true if it’s a cap I want the user to have. It’s up to me to determine if it’s appropriate at their location in the universe. Yes?
All integration guides appear to have the userbase in WP. I was in the situation where my userbase was in bbPress, so I needed to get all my bb_users into wp_users.
The following refers to WP2.7 and bbPress 1.06a.
The process is actually quite straight forward but do make backups of your database beforehand!
- First delete ‘wp_usermeta’ and ‘wp_users’ tables (having made that backup!)
- Change the name of ‘bb_usermeta’ to ‘wp_usermeta’ and ‘bb_users’ to ‘wp_users’.
- The tables structures from bbP are the same as WP apart from one field in the ‘_users’ table. So we need to add FIELD: user_activation_key TYPE: varchar(60) NULL: NO after the ‘user_registered’ field.
- The problem now is that none of these users have their WP roles defined.
- To do this we need to insert the ‘meta_key’ and ‘meta_value’ to ‘wp_capabilities’ and ‘a:1:{s:10:”subscriber”;b:1;}’ for each user.
- wordpress_capabilites.sql contains an SQL insert statement for 5000 users. If your userbase is less than that you only need to run it for your number of users (although we deal with overruns in a minute).
- Once this has run each user will have ‘subscriber’ status within wordpress. You need to manually change your bbPress key holder (most likely user_id 1) ‘wp_capabilities’ to ‘a:1:{s:13:”administrator”;b:1;}’. This gives that account administrator status within WP.
- It’s highly likely that you’ll have deleted some users in the past, or run too many INSERTs from the wordpress_cabalilities file, so we need to delete all those ‘wp_capabilities’ that aren’t mapped to an exisiting user.
- SQL: ‘select * from wp_usermeta where user_id not in (select ID from wp_users)’ will list all these non-existent users.
- It probably a good idea to do a full backup of your tables right now just in case.
- Now run this SQL: ”delete from wp_usermeta where user_id not in (select ID from wp_users)” – this will delete all those stray entries.
- Done.
All worked out with the help of someone I work with, so I can’t take all the credit

Good luck.
Lets say in theory I was going to try and integrate bbPress’s functions into WordPress.
Theoretically, where would I look if I didn’t want bbPress to clear out the wp_head function?
Topic: bb Code not working
I’m having trouble getting bb codes to work, via plugin buttons or otherwise. I even hard coded a link to a podcast on one of my other blogs, and url code isn’t working. Any idea what the problem is?
Topic: Visit counter
I have an account on http://www.realcounter.eu that lets you create in a personalized way of the meters to insert into right site, blog and forums.
I wanted to know where should I include this Code because it is displayed in:
Homepage, in the categories and finally on the individual post
Sorry for my bad English are Italian and forgive me for a possible wrong of Section
I have this error message on every post…
bbPress database error: [Table ‘harrismarineblog.wp_lvtwfff_usermeta’ doesn’t exist]
SELECT * FROM wp_lvtwfff_usermeta WHERE user_id = 3 AND meta_key = ‘post_count’
bbPress database error: [Table ‘harrismarineblog.wp_lvtwfff_usermeta’ doesn’t exist]
INSERT INTO wp_lvtwfff_usermeta (
user_id,meta_key,meta_value) VALUES (‘3′,’post_count’,’353′).
Also no one can log in even admin it keeps saying username not registered.
Does anyone know how to fix this???
I can’t make this plugin work
Do you have it working in your bbpress installation?