Forum Replies Created
-
In reply to: bbpress profile integrates with bp
Ya. Gotta do that too. User had a problem with the sequence of plugin inits. That’s the solution thanks.
In reply to: bbpress profile integrates with bpThe problem using xmlrpc is that it doesn’t trigger the ‘wp’ action that bp wakes up to. I had no intention of doing so myself at the time of writing bbGroups. I didn’t know what kind of mayhem that might entail. I was trying to be as minimally invasive as possible and not cause more problems than I usually do.
In reply to: bbpress profile integrates with bpOk John. If you downloaded that 0.24 zip do it again. The one on the net has initialization of globals for all components now. Except the forums component. It does something that I don’t have time to investigate right now and I don’t know the exact implications of it.
In reply to: bbpress profile integrates with bpCreate a file called oci_bp_custom.php and put it in the same dir as oci_bp_group_forums.php. Create a filter like:
function johns_filter($user){
$user = “johns info going across to bbpress and bb user meta”;
return $user;
}
add_filter(‘oci_get_user’,’johns_filter’,10,1);
This traps the filter you want ‘oci_get_user’ with add_filter(). It says trap that filter and call the function ‘johns_filter’ we just created. Give this filter a priority of 10 which is normal and the function johns_filter() takes one parameter.
The $user array that johns_filter() gets when called contains the user id as $user that was built in my fn oci_get_user(). Anybody can create more filters now and add more info that goes across and gets associated with every user.
Once you import again all your new info will get put into meta data for use each time the ‘bbGroups’ info gets pulled out for the current user. This plugin was designed for people who are not running deep integration. It works for you but frankly the xmlrpc overhead is not needed. You have access to all the bp data and functions. One thing you might run into is that the data you are trying to get at and the functions are not initialized yet by the bbGroups plugin. I only fire up the global vars for the components I need. I just do:
function oci_bp_group_forums() {
// only do this if the xmlrpc server is firing up and we are servicing a request
if ( defined(‘XMLRPC_REQUEST’) && XMLRPC_REQUEST ){
// bp’s globals don’t get set until a ‘wp’ action occurs. this seems to be all that is needed.
bp_core_setup_globals();
groups_setup_globals();
bp_activity_setup_globals();
}
}
add_action(‘init’,’oci_bp_group_forums’);
That gets core, groups and activity globals initialized. You are going to have to fire up the xprofile globals yourself:
xprofile_setup_globals();
Well, hang on a sec and I’ll include that in my ‘init’ handler.
In reply to: new admin – no workyThere is a difference in mu between a user with ‘administrator’ rights and the user ‘admin’ who is user id ‘1’. Site admin is user id ‘1’. Different.
In reply to: bbpress profile integrates with bpI didn’t have time to dig through the xprofile component to do exactly what you want but I did have time to do this. I added a filter to the group and user data that goes across to bbpress. There are two fns that build the associative array of info that goes across and gets stuffed into bbpress forum and user meta tables.
I added the filter ‘oci_get_user’ to the oci_get_user() fn and ‘oci_get_group’ to the oci_get_group() fn. I also did a little demo of how to create such a filter for any data you want to go across to bbpress. I pulled the user’s forum list and the list of forums where the user is ‘staff’ and implemented that as a filter. It doesn’t get created or include by the fn I created for that purpose anymore. It uses a filter. oci_get_user() builds and includes info from the bp user obj and then calls the filter for the added and needed forum info.
/**
* oci_get_user_filter()
*
* Live example of how to use the filter mechanism to add info to the data going across to bbpress
* This filter adds the user’s forums and forums where the user is staff into the $user array
* @return
* @param associative array $user from oci_get_user()
*/
function oci_get_user_filter($user){
$users_group_info = oci_get_users_group_info($user);
$user = $users_group_info;
$user = $users_group_info;
return $user;
}
add_filter(‘oci_get_user’,’oci_get_user_filter’,10,1);
The data being stuff into the $user array used to be included in the oci_get_user() fn and now it’s being included in that filter.
You just need to create your own filter fn and trap the ‘oci_get_user’ filter chain like I did above. The zip with the new capability is available on my site as:
http://ourcommoninterest.org/downloads/bp_group_forums_0.24.zip
I didn’t bump the ver number, change the readme.txt or update the plugin’s blog post yet. This reply is the docs for the moment.

You have to be careful what you send across. Only primitive types can go over through xmlrpc. No objects. int, string, bool, array…
In reply to: bbpress profile integrates with bpHi John, sure it’s possible. bbGroups sends over an associative array of user info. I’ll add a filter mechanism to allow people to add or modify the data going across to bb. On the bb side that entire array just gets stuffed into user meta. Doesn’t care or look at what it is. It just gets pulled out in a chunk from user meta with the key ‘bbGroups’.
Gimme a few to implement that and I’ll upload that version to my site.
In reply to: RC-1 – admin-bar-menu acting weird?sgrunt, works like a charm for me! Thanks. Can you post this in trac for everybody please? Just those two changes to those elements.
In reply to: Widget Ajax Members Group ProblemThat leads us to: bp’s ajax is returning a result but the js is not refreshing the page. It’s not just bp’s js then it’s the pipes.yahoo.com stuff too. Got me as to why.
In reply to: How to upgrade?Well, I don’t know how others do it but I test the upgrade on a dev server, merge any custom that needs to have that done and upload to the live server overwriting all in mu-plugins. Same as you it seems.
The creator of bp, Andy, is creating an enhancement that is being tested now for wpmu 2.7.1 that allows auto upgrades and activation for site wide plugins in wpmu. This means ‘pushbutton’ upgrades for bp. yah!
In reply to: RC-1 – admin-bar-menu acting weird?sgrunt, the solution to the gap problem would be very welcome!
In reply to: default user blogsThis is something every site admin wants to know and there are about a million solutions for this. Try the mu forums and the wp plugins area. Everybody has different requirements and solutions. The answer is there is no builtin way to do this in wpmu. wpmu leaves that up to the site admin/designer/programmer.
In reply to: Only one blog for userHey nicola, There are hooks for blog creation but wp doesn’t record the fact that ‘this user created this blog’. wp’s get_blogs_of_user() returns blogs where the user has any role. Being an ‘administrator’ in a user meta wp_BLOGID_capabilities list doesn’t mean the user created that blog.
The creation process has to be recorded somewhere and the only place is in bp’s bp_user_blogs table. As far as I know. Be more than happy to learn otherwise. I learn something new every day around here.
In reply to: Only one blog for userYou betcha de nada.
Hanging out here has caused my picture perfect English to degenerate into a mashup of American street slang and various foreign languages. Actually, I don’t consider that to be a bad thing. Of course this speaking ‘Burtlish’ could backfire on me. I think I said something like “you’re lucky!” to our Italian friend. I also could have said “you asshole!” if I’m not mistaken.
In reply to: Widget Ajax Members Group ProblemI have no idea what a yahoo pipes mashup is. What is a yahoo pipes mashup?
In reply to: plugin-template.php using member theme?tekanji, sorry if my response to you was kinda abrupt. I get ‘tech support cranky’ some times. Ask me ‘how’ and I might be able to help. Ask me ‘why’ and I get defensive even though I didn’t write this software.
In reply to: plugin-template.php using member theme?The plugin-template.php file does exist in the member theme. I don’t know of anyone who has tried such a thing. The member theme has a header and footer file. Andy keeps telling me that any WP theme can be converted to a member theme. There may be some guidelines that you might find useful in the /wp-content/member-themes/member-themes-readme.txt.
Andy keeps insisting that it’s not a big problem. I keep saying ‘uh huh’ and ignoring him. Andy is usually right.
In reply to: plugin-template.php using member theme?You are asking in a support forum why design decisions were made and why, considering the evolutionary nature of software, bp ended up as it did. As an end user of bp I have absolutely no idea how to answer either of those questions.
The real answer is that things don’t have to be like they are if you don’t want them to be. Come up with an enhancement and share it with us. That’s the beauty of open source under a GPL license.
Code is Freedom.
In reply to: plugin-template.php using member theme?The member theme is not a standard WP theme it can’t be used as such. It puts up the error message because it’s required.
In reply to: after login redirect to another pagelol. I was just looking for that thread. Thanks. Guess what? I tagged it this time I found it ‘redirect’, ‘login’.
In reply to: Only one blog for userThat code checks the bp_user_blogs table to see if any blogs have been created for the user. It won’t care about the role a user has in an exiting blog. I checked ‘author’ and ‘administrator’ roles for a blog and it didn’t care. As long as you don’t create a blog for that user in either bp or wpmu backend looks like it ignores them because they haven’t created the blog.
So I guess the answer is yes, John. You can still add users to blogs at any role you want and later on a user can still create a blog for themselves not matter what role they play in the mu blog network as long as they haven’t created a blog.
This is really not the best mechanism to control this but I didn’t see the usual level of ‘actions’ and ‘filters’ in the blogs component that other areas of bp have. Gotta post an enhancement ticket in trac for that I guess.
In reply to: finding out user_levelThere’s this function in the bp admin bar:
// return a string indicating user’s role in that blog
function get_blog_role_for_user( $user, $blog ) {
// If the user is a site admin, just display admin.
if ( is_site_admin() )
return __( ‘Admin’, ‘buddypress’);
$roles = get_usermeta( $user, ‘wp_’ . $blog . ‘_capabilities’ );
if ( isset( $roles ) )
$role = __( ‘Subscriber’, ‘buddypress’ );
elseif ( isset( $roles ) )
$role = __( ‘Contributor’, ‘buddypress’ );
elseif ( isset( $roles ) )
$role = __( ‘Author’, ‘buddypress’ );
elseif ( isset( $roles ) )
$role = __( ‘Editor’, ‘buddypress’ );
elseif ( isset( $roles ) )
$role = __( ‘Admin’, ‘buddypress’ );
else
return false;
return $role;
}
It determines the user’s role. That what you need?
You might just be missing the current user in that function you created. Gotta remember the global vars.
global $current_user;
The info that bp tracks for a user is what bp needs to know about the user. The rest is provided by wpmu.
In reply to: Only one blog for user@federichobo, Che culo!
Testing my Italian slang.
In reply to: plugin-template.php using member theme?Nope. Sorry. The directories all have their own css you can skin. bp has a site-wide.css file you can drop into your theme in /themes/<your theme>/css/site-wide.css
In bp-core-cssjs.php which fires up the css and js for bp is this fn:
function bp_core_add_css() {
// Enable a sitewide CSS file that will apply styles to both the home blog theme
// and the member theme.
if ( file_exists( WP_CONTENT_DIR . ‘/themes/’ . get_blog_option( 1, ‘stylesheet’ ) . ‘/css/site-wide.css’ ) )
wp_enqueue_style( ‘site-wide-styles’, WP_CONTENT_URL . ‘/themes/’ . get_blog_option( 1, ‘stylesheet’ ) . ‘/css/site-wide.css’ );
wp_print_styles();
}
add_action( ‘wp_head’, ‘bp_core_add_css’ );
In reply to: Only one blog for userOK people this seems to work. This requires modifying the member theme since I didn’t find any actions in bp to hook this into so here goes:
In the member theme the file:
/buddypress-member/blogs/create.php
There is this chunk of code:
<?php if ( bp_blog_signup_enabled() ) : ?>
..(some other stuff here)..
<?php else: ?>
<div id=”message” class=”info”>
<p><?php _e( ‘Blog registration is currently disabled’, ‘buddypress’ ); ?></p>
</div>
<?php endif; ?>
Replace the ..(some other stuff here).. with this:
<?php
global $bp;
$blogs = bp_blogs_get_blogs_for_user($bp->loggedin_user->id);
if (!$blogs)
{
bp_show_blog_signup_form();
}
else
{
?>
<div id=”message” class=”info”>
<p><?php _e( ‘Limit one Blog per member’, ‘buddypress’ ); ?></p>
</div>
<?php
}
?>
This is the entire little create.php file in pastie: http://pastie.org/396083
This was a: “quick ya we should have that and I’ve got to get to the store and get some boxes because I’m moving from Michigan where we have a snow storm today and Virginia where I’m moving to comes to a screeching halt when they get 1″ of snow and I gotta run now” solution.
When I get back from the store I’ll help clean up the damage this might cause. This does work for me in a quick test.