Search Results for 'buddypress'
-
AuthorSearch Results
-
April 23, 2009 at 5:27 am #43282
In reply to: Limit Blog Creation to Admins
squattingturnip
ParticipantThank you, thank you, thank you.
Your code works like a charm, and you have taught me a great deal about how BuddyPress (and WPMU) works. I really, really appreciate it.
Incidentally, the changes I made are as follows, in case your or anyone else is curious:
global $current_user;
if ( isset( $roles['administrator'] ) || isset( $roles['editor'] ) || isset( $roles['contributor'] ) || is_site_admin() )was added to the “my_can_user_create_a_blog” function. Kind of an odd set of conditions, but, well…whatever. I\’m going to do a little bit of digging around later on, and see if I can condense that down a little (initially I’d planned to have it as a sort of “if user level is great than x” thing, but my cursory examination didn’t turn that up, so this is a decent stopgap for now).
I also added an if statement that draws on the “my_can_user_create_a_blog” function for the “my_blogs_setup_nav” function, so that now everything it does is wrapped thusly:
if (my_can_user_create_a_blog()==true) {
...
}and changed “is_user_logged_in” in the “my_adminbar_blogs_menu” function to call “my_can_user_create_a_blog” instead.
Again, I can’t thank you enough. I only hope some day I can help someone out the way you’ve helped me.
April 23, 2009 at 4:51 am #43278In reply to: FAQ: How To, Code Snippets and Solutions
Burt Adsit
ParticipantLimiting the creation of blogs to certain user roles such as Site Admin
This thread describes how to modify the both the admin bar and the member theme navigation functions using bp-custom.php. No core mods needed. It can give you an idea of how to modify any bp function that responds to an action.
April 23, 2009 at 4:30 am #43277In reply to: How to: Modify the bp admin bar
Burt Adsit
Participant@Tutsie, upgrade to RC2/trunk. That feature was added some time ago.
@Hyrxx, you’d have to move the logo into the actual
<ul><li>structure of the menu itself. Right now it sits outside of that. It’s not really part of the menu as of now. I just finished doing a tutorial on altering the admin bar as part of this thread: https://buddypress.org/forums/topic.php?id=2283Believe it or not I’m getting kinda burned out on the admin bar. I know it’s one of the most visible aspects of bp. It is also one of the easiest ways to allow your users to navigate to important areas of your site. I just don’t have time to tackle that right now. I have a project I’m working on that needs attention.
April 23, 2009 at 4:04 am #43276In reply to: adding new field to group
isuru
Participantsry, this is the source code. i have mentioned the functions which i modified only.
the screen “create new group” appears with added field, the error is given when saving.
what are the other files to be modified????????
<?php
/**********************
bp-group.php
**********************/
function groups_install() {
/*some code goes here*/
$sql[] = “CREATE TABLE {$bp->groups->table_name} (
…………..
author varchar(50) NOY NULL,
………….
) {$charset_collate};”;
/*some code goes here*/
}
function groups_check_installed() {
if(is_site_admin()){
if ( !$wpdb->get_var(“SHOW TABLES LIKE ‘%” . $bp->groups->table_name . “%'”) || ( get_site_option(‘bp-groups-db-version’) < BP_GROUPS_DB_VERSION ) )
groups_install();
}
/*some code goes here*/
}
function groups_screen_group_admin_edit_details() {
/*some code goes here*/
if ( $bp->current_component == $bp->groups->slug && ‘edit-details’ == $bp->action_variables[0] ) {
if ( $bp->is_item_admin || $bp->is_item_mod ) {
if ( isset( $_POST[‘save’] ) ) {
if ( !groups_edit_base_group_details( $_POST[‘group-id’], $_POST[‘group-name’], $_POST[‘group-desc’], $_POST[‘group-news’], $_POST[‘author’], (int)$_POST[‘group-notify-members’] ) ) {
bp_core_add_message( __( ‘There was an error updating group details, please try again.’, ‘buddypress’ ), ‘error’ );
} else {
/*some code goes here*/
}
/*some code goes here*/
}
do_action( ‘groups_screen_group_admin_edit_details’, $group_obj->id );
bp_core_load_template( ‘groups/admin/edit-details’ );
}
}
}
add_action( ‘wp’, ‘groups_screen_group_admin_edit_details’, 4 );
function groups_create_group( $step, $group_id ) {
/*some code goes here*/
if ( is_numeric( $step ) && ( 1 == (int)$step || 2 == (int)$step || 3 == (int)$step || 4 == (int)$step ) ) {
if ( !$group_obj )
$group_obj = new BP_Groups_Group( $group_id );
switch ( $step ) {
case ‘1’:
if ( !check_admin_referer( ‘groups_step1_save’ ) )
return false;
if ( $_POST[‘group-name’] != ” && $_POST[‘group-desc’] != ” ) {
/*some code goes here*/
$group_obj->author = stripslashes($_POST[‘author’]);
/*some code goes here*/
if ( !$group_obj->save() )
return false;
/*some code goes here*/
}
break;
/*some code goes here*/
}
}
function groups_screen_create_group() {
/*some code goes here*/
if ( isset( $_POST[‘save’] ) || isset( $_POST[‘skip’] ) ) {
/*some code goes here*/
if ( !$group_id = groups_create_group( $create_group_step, $_SESSION[‘group_obj_id’] ) ) {
/* error message*/
} else {
/*some code goes here*/
}
/*some code goes here*/
}
/*some code goes here*/
bp_core_load_template( ‘groups/create’ );
}
function groups_edit_base_group_details( $group_id, $group_name, $group_desc, $group_news, $group_author, $notify_members ) {
/*some code goes here*/
if ( !check_admin_referer( ‘groups_edit_group_details’ ) )
return false;
if ( empty( $group_name ) || empty( $group_desc ) )
return false;
/*some code goes here*/
$group->news = $group_news;
/*some code goes here*/
if ( !$group->save() )
return false;
if ( $notify_members )
groups_notification_group_updated( $group->id );
/*some code goes here*/
}
function groups_screen_group_admin_edit_details() {
/*some code goes here*/
if ( $bp->current_component == $bp->groups->slug && ‘edit-details’ == $bp->action_variables[0] ) {
if ( $bp->is_item_admin || $bp->is_item_mod ) {
if ( isset( $_POST[‘save’] ) ) {
if ( !groups_edit_base_group_details( $_POST[‘group-id’], $_POST[‘group-name’], $_POST[‘group-desc’], $_POST[‘group-news’], $_POST[‘author’], (int)$_POST[‘group-notify-members’] ) ) {
/*error message*/
} else {
/*some code goes here*/
}
/*some code goes here*/
}
/*some code goes here*/
}
}
}
//add_action();
/**********************
bp-groups-classes.php
**********************/
class BP_Groups_Group {
/*some code goes here*/
var $news;
function populate( $get_user_dataset ) {
/*some code goes here*/
if ( $group ) {
/*some code goes here*/
$this->author = stripslashes($group->author);
/*some code goes here*/
}
}
function save() {
/*some code goes here*/
if ( $this->id ) {
$sql = $wpdb->prepare(
“UPDATE {$bp->groups->table_name} SET
author = %s,
WHERE
id = %d
“,
/*some code goes here*/
$this->author,
/*some code goes here*/
);
} else {
$sql = $wpdb->prepare(
“INSERT INTO {$bp->groups->table_name} (
news,
) VALUES (
%s
)”,
/*some code goes here*/
$this->author,
/*some code goes here*/
);
}
/*some code goes here*/
}
}
/**********************
bp-groups-filters.php
**********************/
add_filter( ‘bp_group_author’, ‘wptexturize’ );
add_filter( ‘bp_group_author’, ‘convert_smilies’ );
add_filter( ‘bp_group_author’, ‘convert_chars’ );
add_filter( ‘bp_group_author’, ‘wpautop’ );
add_filter( ‘bp_group_author’, ‘make_clickable’ );
/**********************
bp-groups-templatetags.php
**********************/
/*some code goes here*/
function bp_group_author() {
global $groups_template;
echo apply_filters( ‘bp_group_author’, stripslashes($groups_template->group->author) );
}
function bp_group_author_editable() {
global $groups_template;
echo apply_filters( ‘bp_group_author_editable’, $groups_template->group->author );
}
/*some code goes here*/
function bp_group_create_form() {
/*some code goes here*/
?>
<form action=”<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/create/step/<?php echo $create_group_step ?>” method=”post” id=”create-group-form” class=”standard-form” enctype=”multipart/form-data”>
<?php switch( $create_group_step ) {
case ‘1’: ?>
<label for=”author”>* <?php _e(‘Author’, ‘buddypress’) ?></label>
<textarea name=”author” id=”author”><?php echo ( $group_obj ) ? $group_obj->author : $_POST[‘author’]; ?>
</textarea>
<?php do_action( ‘groups_custom_group_fields_editable’ ) ?>
<p><input type=”submit” value=”<?php _e(‘Create Group and Continue’, ‘buddypress’) ?> »” id=”save” name=”save”/></p>
<?php wp_nonce_field( ‘groups_step1_save’ ) ?>
<?php break;
/*some code goes here*/
}
}
?>
April 23, 2009 at 3:54 am #43275In reply to: How to: Modify the bp admin bar
hyrxx
Participantis it possible to have the admin menu start on the buddypress image, rather than my account,
i plan to rewrite all the menu items when i redesign my site, and i want to attach a menu to the buddypress ‘home’ link
April 23, 2009 at 3:35 am #43274In reply to: Limit Blog Creation to Admins
Burt Adsit
ParticipantBack from break. Since I\’ve been creating this stuff out of thin air and it might be a good time to test this. brb.
Well, something went right today. This seems to work. I had to add a hook for the \’wp_footer\’ action that actually triggers the admin menu. The code in a copy/paste format is available here:
http://buddypress.pastebin.com/fce770ad
Copy and paste that into your bp-custom.php file. You can then alter the minimal logic in the function my_can_user_create_a_blog() to determine who and when people can see the \’create a blog\’ menu items scattered throughout bp.
Let me know how this works for you or if I’ve missed anything.
April 23, 2009 at 2:51 am #43273In reply to: Problem with News CSS
Tutsie
ParticipantI am using the orange “Download” version of BuddyPress, I tried switching back to the default theme and it didnt fix it, I deactivated the WP-Forums plugin and that fixed it……I would like to continue to use WP-Forums so why is that plugin affecting it?
April 23, 2009 at 1:38 am #43268In reply to: Still no Avatar fix?
Jeff Sayre
ParticipantDo you have any other plugins besides BuddyPress installed? Do you receive any error messages?
Have you read this post? https://buddypress.org/forums/topic.php?id=2190#post-11864
April 23, 2009 at 1:22 am #43265In reply to: Limit Blog Creation to Admins
Burt Adsit
ParticipantWe’ve unhooked the current fns and hooked up our replacement fns. So far they do exactly the same thing as the current fns. We need the ability to decide who gets to see the menu item. I choose to create yet another fn to decide yes or no on blog creation.
function my_can_user_create_a_blog(){
if (is_site_admin())
return true;
else
return false;
}
That goes in bp-custom.php also. Ya, all it does is check if the current user is the site admin. I’m not sure what you mean by only letting ‘Admins’ create blogs. There are blog admins and one site admin. Everyone with a blog gets to have the wp role ‘administrator’. Not sure what you want so i’ve wrapped the logic in a fn so you can change it to whatever you like.
Now we need to alter our new replacement fns to skip the display of the menu items if that returns false.
In our my_blogs_setup_nav() there is a line like this:
bp_core_add_subnav_item( $bp->blogs->slug, ‘create-a-blog’ __(‘Create a Blog’,
‘buddypress’), $blogs_link, ‘bp_blogs_screen_create_a_blog’ );
We need to wrap it like this:
if (my_can_user_create_a_blog()){
‘bp_core_add_subnav_item( $bp->blogs->slug, ‘create-a-blog’Create a Blog’,’buddypress’), $blogs_link, ‘bp_blogs_screen_create_a_blog’ );
}
Also the function my_adminbar_blogs_menu() has code that looks like this:
echo '<li' . $alt . '>';
echo '<a href="' . $bp->loggedin_user->domain . $bp->blogs->slug . '/create-a-blog">'
. __('Create a Blog!', 'buddypress') . '</a>';
echo '</li>';You need to wrap that the same way:
if (my_can_user_create_a_blog()){
..all that stuff..
}
April 23, 2009 at 1:17 am #43264In reply to: Defualt member theme not working
Jeff Sayre
ParticipantTo better help you, we need a few more details.
- Are there any errors in the log files? If so, what are they?
- Are you using any plugins other than BuddyPress? If so, have you tried deactivating them and seeing what happens?
- Did you make any changes to the .htaccess file? If so, what were they?
- Did you install the .htaccess file in WPMU’s root?
Here are some other things to do before replying:
- Read the first post in this thread very carefully again and make sure that you have BuddyPress installed in the proper location and the various theme files put in their proper place.
- Although not everything applies to your situation, please read this thread entirely.
April 23, 2009 at 12:53 am #43260In reply to: Still no Avatar fix?
Jeff Sayre
ParticipantWhich versions of WPMU and BuddyPress are you running?
April 23, 2009 at 12:51 am #43259In reply to: Problem with News CSS
Jeff Sayre
ParticipantI’ve looked ever so briefly at your site’s CSS files. It seems that you have customized the standard BuddyPress themes somewhat rather than creating a custom theme from scratch. So, here are some initial debugging steps and questions:
- Which version of BuddyPress are you using? The one from the large, orange “Download” button?
- Have you tried switching back to the default BuddyPress themes and see what happens?
- Have you disabled the WP-Forums plugin in WPMU backend and see if the problem goes away?
Finally, having the proper tools can help you figure out many CSS issues. I highly recommend that you use Firefox with the Firebug Add-on.
April 23, 2009 at 12:13 am #43255In reply to: Limit Blog Creation to Admins
Burt Adsit
ParticipantThe member theme Blogs > Create a Blog and the admin bar My Account > Blogs > Create a Blog both get their menu items from the bp options nav array that each component sets up when they go through their init procedure.
In the case of the blogs component it’s the fn bp_blogs_setup_nav() in /buddypress/bp-blogs.php
The other menu item is the admin bar option My Blogs > Create a Blog at the bottom of that menu. That lives in the fn function bp_adminbar_blogs_menu() in /buddypress/bp-core/bp-core-adminbar.php
Without modifying the core files we can replace both of these fns with our own since they are triggered by actions in wp.
bp_blogs_setup_nav() responds when triggered like this:
add_action( ‘wp’, ‘bp_blogs_setup_nav’, 2 );
add_action( ‘admin_menu’, ‘bp_blogs_setup_nav’, 2 );
bp_adminbar_blogs_menu() responds when triggered like this:
add_action( ‘bp_adminbar_menus’, ‘bp_adminbar_blogs_menu’, 6 );
(Saving again…)
April 23, 2009 at 12:05 am #43253In reply to: WP-Forum and BuddyPress
Tutsie
ParticipantIm trying to do the same thing…do you think you could go into a little more detail to help me out? thanks!
April 22, 2009 at 11:55 pm #43252In reply to: Limit Blog Creation to Admins
Burt Adsit
ParticipantBen, I took a look at something similar before. There were multiple requests for limiting the number of blogs a user could create. I came up with the only solution I could find at the time: https://buddypress.org/forums/topic.php?id=1328
bp relies on wpmu’s settings for blog creation. wpmu controls this in the site admin back end. Site Admin > Options > Allow New Registrations. Whatever solution to your request is has to take into that setting in wpmu. It’s basicly an on/off kinda thing. You either can or can’t. It’s not based on user role.
Disabling the registration/signup ‘gimme a blog’ option and you have people still able to create blogs after logging in. Let’s say we set that to ‘Only logged in users can create new blogs.’. It’s a start.
So, now only logged in users can create blogs. The create a blog on registration is gone. Next issue is the need to let certain roles see and use the ‘create a blog’ option.
This exists in the member theme Blogs > Create a Blog and in the admin bar under My Blogs > Create a Blog and My Account > Blogs > Create a Blog.
(Saving this while I dig thru some code…)
April 22, 2009 at 11:29 pm #43251Jeff Sayre
ParticipantBurt-
Thanks for reminding us of the buddypress.pastbin and for pasting in Andy’s WP abstraction functions. This will be handy.
April 22, 2009 at 11:18 pm #43250Burt Adsit
ParticipantI added Andy’s bp-core-wpabstraction.php file to the bp pastebin for discussion.
http://buddypress.pastebin.com/f578203cb
I suggest *not* abstracting is_site_admin() because it’s a commonly used mechanism for detecting wpmu. if (function_exists(‘is_site_admin’)) should return true on wpmu and false on wp. I know that the abstraction file is so that we don’t have to care, but….
April 22, 2009 at 10:20 pm #43248In reply to: Defualt member theme not working
aishaladon
ParticipantHi Chris,
Try this. Im working on it now.
https://buddypress.org/forums/topic.php?id=2217
Go into plugins and install buddypress community plugin, activate it site wide, and than install buddy press
April 22, 2009 at 9:17 pm #43245In reply to: Release Dates ???
Jeff Sayre
ParticipantAndy just announced via Twitter that, barring any unforeseen issues, RC-2 will be out tomorrow and within a week he hopes to have the official, public release of version 1.0 of BuddyPress!
April 22, 2009 at 7:20 pm #43237In reply to: Group Page
enlightenmental1
Participanthome-page
/members
/groups
all use the default bp-home theme
members and groups pages use the members-theme
that’s why some of your pages have the green border in the header and some have the orange border…
yes, there are different css files… depends on your version of buddypress
what version?
April 22, 2009 at 7:08 pm #43236enlightenmental1
Participantok… so i have this working on my buddypress install (users only… no blogs)
it creates a new user and pulls as much information as it can
username => firstname
email => email
from there, I direct them to a custom “welcome” page where I explain they must update their profile information (some providers give ugly information)
example:
gmail does:
email => email
username => firstname
yahoo does:
email => email
username => RPX234562983746592745834578
even if the yahoo/gmail account has a first and last name with it, it never pulls it over when the BP account is created
I wish they could still “choose” the username that gets displayed so their profile doesnt become /members/RPX243523452345245645
we’re still working on this on our end…. hopefully we will get it to work successfully/cleanly… but for the most part, it does work
April 22, 2009 at 6:54 pm #43235In reply to: Defualt member theme not working
chriscarter
ParticipantDitto. I’m working on trunk 1381 and WPMU 2.7.1. Everything else works as it should. The buddypress-member folder is within wp-content/bp-themes/. It is the only member theme in that folder and I made sure that it was selected correctly within the BuddyPress settings.
Anyone else?
April 22, 2009 at 5:31 pm #43231In reply to: wpmu 2.7.1 released… RC2 release date?
April 22, 2009 at 4:48 pm #43226In reply to: Prevent users from adding popup scripts
Paul Wong-Gibbs
KeymasterAs always: what version of BuddyPress are you running?
April 22, 2009 at 3:55 pm #43225In reply to: Who wants a media plugin for BP
enlightenmental1
Participantcopy this, add to it, paste it below in your post…. this will get a little overboard i’m sure, but we should list as much as we can and then narrow it down based on:
– if it’s possible
– time to complete
– cost
Features Request:
browser=person browsing the website
user= the individual user/profile owner
– seamless integration with buddypress
– this becomes a component that is activated through the bp admin menu
– and general settings are controlled by the admin in the wp-admin subnav
– not a plugin/mu-plugin
– user can select to only show pics/vids if your the users friend, or show anyone
– user can subscribe to pics/vids gallery rss just like activity rss
– browser can select “view random gallery” or “view random video” from the bp nav bar
– user has “gallery options” under their profile menu
– add/upload/remove/rename/add caption to images and videos
– user has “gallery settings” under their settings menu
– make pics/videos public, show to friends only, etc
– all media uploaded is searchable through the /members page
– a new <directory> is created called “Media” just like the “groups” or “members” or “events”
– this directory shares the default theme of BP and yet is customizable because it has it’s own directory/index.php and directory/media-loop.php (just like BP)
– admin decides how media should be stored
– on the website server
– or on kultura (i have no need for this)
– etc
– admin decides max file size, max storage amount per user and is able to delete any media uploaded
– user is able to choose which uploaded image is set as their avatar
– user is able to create galleries and select a default gallery icon/image (myspace)
– galleries could contain both video and images and are browsable as thumbs
– thumbnail image is “thickbox ready” and pops up both pics and video into a jquery thickbox with button for next / previous / close etc
– Gallery content/information/descriptions etc becomes bp-Xprofile data that can gotten and displayed much the same as regular bp-xprofile data (get_bp_xprofile data ect)
– except for the admin options, all gallery controls and content remain on the front-end/profile only
the list goes on and on… and there’s many ways this could all be done
add to the above, remove stuff (say why you removed)
I dont think these features are “too much” considering there’s $700 available for this project… I’m also open to a different developer…. this should be someone who lives and breathes buddypress and who keeps current with both wpmu and bp trunk versions
we would also need to know/specify which install we want this created for
wpmu 2.7.1 + BP RC1
wpmu 2.7 + BP RC1
wpmu 2.7.1 + BP latest trunk
etc… because chances of this working well on all the different install variation is tricky
worst case scenario, all we get is the $200 job and we have to make due
(im still down with that too)
I would like the developer to brainstorm and come up with a list of features that THEY think are possible considering the budget
$200 gets you ___________.
$700 gets you ___________.
($700 would get us something pretty damn cool from the right dev… and remember, if it’s done right Andy will add this to the BP core which I believe is the best option)
-
AuthorSearch Results