Search Results for 'Hide Admin'
-
AuthorSearch Results
-
March 3, 2010 at 11:09 pm #66597
In reply to: Hide main theme from users
Andrea RennickParticipantGo to the Site Admin menu -> Themes and disable them there.
It does not deactivate the themes, it removes them from the Appearances tab.
March 3, 2010 at 2:40 pm #66529joezsweetMemberOk it’s working on wpmu + buddypress, i’ve correctly set on secondary blog.
Now i’ve another question is possible to hide buddypress admin bar on main blog and have it displayed only on secondary?
Thanks
March 2, 2010 at 1:44 pm #66327In reply to: How to control spam registration?
WindhamdavidParticipantAll in all, here’s my approach that I use on MU/BP sites ~
1) modify the register/register.php wp-signup.php hardcoded default text and url slugs.
2) enable xprofile and require additional fields upon registration.
2) use a captcha ~ i’m fond of ReCatcha
3) make sure you and check the NO setting under “Allow blog administrators to add new users to their blog via the Users->Add New page. ” in wp-admin/wpmu-options.php “Admin > Site Options”
4) I ban or limit the registration domains (also in Admin > Site Options) so that the commonly used spammer domains are blocked from registration and then I add an email contact for owners of these addresses to manually request registration. I hide the email address from bots with HiveLogic EnKoder
5) I then firewall off entire blocks of IP’s from my servers from commonly used spammer IP ranges you can find at sources like spamhaus.org .. and considering that these are one language sites, the need for access for the IP blocks on the pan asia network or eastern europe are unlikely. If you have a multilingual site, this might cause issues to very few users. Cpanel, Plesk, BSD, etc have tools to do this.. if you’re on a shared server, ask your hosting provider if they can do it for you, and they may be likely doing it already.
6) I also recommend using Askimet.
March 2, 2010 at 5:09 am #66272In reply to: $search_sql in bp-groups-classes.php
edelwaterParticipant1) ] PHP Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /var/www/vhosts/farmvillechicken.com/httpdocs/wp-includes/script-loader.php on line 599, referer: http://almanac.farmvillechicken.com/new-farmville-mystery-boxes-ive-got-a-striped-tent-20091021.html
2) PHP Notice: Undefined property: stdClass::$current_link in /var/www/vhosts/farmvillechicken.com/httpdocs/wp-content/plugins/buddypress-links/bp-links-core.php on line 375, referer: http://almanac.farmvillechicken.com/new-farmville-mystery-boxes-ive-got-a-striped-tent-20091021.html
3) PHP Notice: Undefined property: stdClass::$current_group in /var/www/vhosts/farmvillechicken.com/httpdocs/wp-content/plugins/buddypress/bp-groups.php on line 237, referer: http://almanac.farmvillechicken.com/new-farmville-mystery-boxes-ive-got-a-striped-tent-20091021.html
4) PHP Notice: Undefined property: stdClass::$id in /var/www/vhosts/farmvillechicken.com/httpdocs/wp-content/plugins/buddypress/bp-core/bp-core-adminbar.php on line 192, referer: http://almanac.farmvillechicken.com/new-farmville-mystery-boxes-ive-got-a-striped-tent-20091021.html
5) PHP Notice: Undefined index: hide-loggedout-adminbar in /var/www/vhosts/farmvillechicken.com/httpdocs/wp-content/plugins/buddypress/bp-core/bp-core-adminbar.php on line 9, referer: http://almanac.farmvillechicken.com/new-farmville-mystery-boxes-ive-got-a-striped-tent-20091021.html
6) PHP Notice: Trying to get property of non-object in /var/www/vhosts/farmvillechicken.com/httpdocs/wp-content/plugins/buddypress/bp-groups/bp-groups-templatetags.php on line 121, referer: http://almanac.farmvillechicken.com/new-farmville-mystery-boxes-ive-got-a-striped-tent-20091021.html
7) PHP Notice: Undefined index: s in /var/www/vhosts/farmvillechicken.com/httpdocs/wp-content/plugins/buddypress/bp-groups/bp-groups-templatetags.php on line 67, referer: http://almanac.farmvillechicken.com/new-farmville-mystery-boxes-ive-got-a-striped-tent-20091021.html
PHP Strict Standards: Non-static method BP_Groups_Group::get_group_extras() should not be called statically in /var/www/vhosts/farmvillechicken.com/httpdocs/wp-content/plugins/buddypress/bp-groups/bp-groups-classes.php on line 351, referer: http://almanac.farmvillechicken.com/new-farmville-mystery-boxes-ive-got-a-striped-tent-20091021.html
9) PHP Strict Standards: Non-static method BP_Groups_Group::get_popular() should not be called statically in /var/www/vhosts/farmvillechicken.com/httpdocs/wp-content/plugins/buddypress/bp-groups.php on line 1746, referer: http://almanac.farmvillechicken.com/new-farmville-mystery-boxes-ive-got-a-striped-tent-20091021.html
10) …
February 27, 2010 at 12:09 pm #65839In reply to: new plugin: BuddyPress Rate Forum Posts
andrew_s1ParticipantAt the moment, the classes are added to individual posts in a topic, by javascript. This results in extra server load, because wordpress has to do two whole startups for each such page. The trade-off is adding another apply_filter and a do_action to the theme, but as this plugin already benefits from one such proposed theme change, we can get two for the price of one.
Proposed change to buddypress/bp-themes/bp-default/groups/single/forum/topic.php, from line 26:
<ul id="topic-post-list" class="item-list">
<?php while ( bp_forum_topic_posts() ) : bp_the_forum_topic_post(); ?>
<li <?php
$topic_post_id = bp_get_the_topic_post_id();
echo "id='post-$topic_post_id' class='",
apply_filters('bp_single_forum_topic_post_css',array('class'=>'', 'post_id'=>$topic_post_id)),
"'";
?> >
<div class="poster-meta">
<a href="<?php bp_the_topic_post_poster_link() ?>">
<?php bp_the_topic_post_poster_avatar( 'width=40&height=40' ) ?>
</a>
<?php echo sprintf( __( '%s said %s ago:', 'buddypress' ), bp_get_the_topic_post_poster_name(), bp_get_the_topic_post_time_since() ) ?>
</div>
<div class="post-content">
<?php bp_the_topic_post_content() ?>
</div>
<div class="admin-links">
<?php
if ( bp_group_is_admin() || bp_group_is_mod() || bp_get_the_topic_post_is_mine() ) :
bp_the_topic_post_admin_links();
endif;
do_action( 'bp_single_forum_topic_links' , $topic_post_id );
?>
<a href="#post-<?php echo $topic_post_id; ?>" title="<?php _e( 'Permanent link to this post', 'buddypress' ) ?>">#</a>
</div>
</li>
<?php endwhile; ?>
</ul>Proposed change to buddypress-rate-forum-posts/bp-rate-forum-posts.php, insert:
// modifies the css class for topics to highlight popular posts, and hide very unpopular ones
function rfp_css_class_for_post($args) {
global $rfp;
$class = $args['class'];
$post_rating = rfp_get_post_rating( $args['post_id'] );
$rfpclass = '';
error_log('rfp='.print_r($rfp,true));
if ( $post_rating == NULL )
$rfpclass = '';
else if ( $post_rating >= $rfp->superboost )
$rfpclass = 'rfp-superboost';
elseif ( $post_rating >= $rfp->boost )
$rfpclass = 'rfp-boost';
elseif ( $post_rating <= $rfp->hide )
$rfpclass = 'rfp-hide';
elseif ( $post_rating <= $rfp->diminish )
$rfpclass = 'rfp-diminish';
//error_log("in rfp_css_class_for_post rating '$post_rating' adding class '$rfpclass' to '$class' with args ".print_r($args,true));
return $class.($class?' ''').$rfpclass;
}
add_filter( 'bp_single_forum_topic_post_css', 'rfp_css_class_for_post', 3);
function rfp_echo_hidden_post_link($post_id) {
global $rfp;
$post_rating = rfp_get_post_rating( $post_id );
if ( $post_rating && $post_rating <= $rfp->hide )
echo "<span class='rfp-show' onclick='jQuery(this).remove();jQuery("#post-$post_id").removeClass( "rfp-hide" );'>Click to show this hidden post</span>";
}
add_action( 'bp_single_forum_topic_links', 'rfp_echo_hidden_post_link', 3);And then the javascript section starting
jQuery(document).ready( function()
can be removed from buddypress-rate-forum-posts/js, and the corresponding section can be removed from the end of buddypress-rate-forum-posts/rate.phpFebruary 27, 2010 at 8:57 am #65817In reply to: Security problem – how do i hide the admin account?
nickritaParticipantwebby, it will be in the memberlist, but nobody will know, that this member is the admin.
February 26, 2010 at 5:23 pm #65725In reply to: Search Function in Admin Bar
Kevin PineParticipantTo move the search try adding this to your CSS:
#search-form {margin-right:30px;}
You can also hide the ‘Visit’ menu item with the following CSS:
#bp-adminbar-visitrandom-menu{display:none}
February 25, 2010 at 10:58 pm #65609In reply to: Security problem – how do i hide the admin account?
w101ParticipantOusep, thanks for the advice… but wouldn’t I be in the same situation? My new admin account named “whatever” would still be visible in the member list.
I’m trying to keep people from seeing it…
February 25, 2010 at 7:18 pm #65582In reply to: Security problem – how do i hide the admin account?
ousepParticipantIf you don’t want to get into the database, the simplest way would be to create another administrator account, logging in as the new admin, and deleting the user named admin.
PS: @hnla Buddypress now works with regular WP, too.
February 25, 2010 at 6:31 pm #65572In reply to: Security problem – how do i hide the admin account?
Hugo AshmoreKeymasterI would be careful about confusing plain single user WP with WPMU they are not exactly the same beast and that list – which is written with single user WP in mind – suggests things that would perhaps be inadvisable such as renaming DB tables.
As for hiding the admin account not really sure it’s that huge a concern? but others may suggest a means.
February 25, 2010 at 5:29 pm #9236w101ParticipantReading over this post http://www.antezeta.com/blog/top-wordpress-security-tips I came across point 3:
3. Change the default Admin Account user from “adminâ€
My question is, HOW do I keep this new, supposed secret, admin account from appearing on the member list?
February 18, 2010 at 6:08 pm #8959Topic: hide body of message
in forum How-to & TroubleshootingintimezParticipantIs there a plugin to hide the body of message when using the private message function notification or does a file need to be modified? If file, which one? TIA
example:
from this
============================
user123 sent you a new message:
Subject: this is a test
“is this working? thanks.”
To view and read your messages please log in and visit: http://example.com/members/admin/messages/
============================
to this
============================
user123 sent you a new message:
Subject: this is a test
To view and read your messages please log in and visit: http://example.com/members/admin/messages/
============================
February 14, 2010 at 1:43 pm #8835annie_sp04ParticipantSince updating to BP 1.2 rc3 I can no longer hide the admin bar for logged out users, I thought I messed up the upgrade from rc2, and tried a fresh install, but i still can’t disabled it even having it set to hide the bar on BP’s general settings. I’m not using any plugins other than BP. Any ideas how to disabe it?
Thanks
February 12, 2010 at 2:15 am #63139snarkParticipantI found this code that can be wrapped around anything to hide it from everyone but administrators or ediors:
<?php if ( current_user_can( ‘delete_others_posts’ ) ) { //only admins and editors can see this ?>
(Items to be hidden here)
<?php } ?>
To make it work specifically for hiding that “Create a Group” button, I made a new version of the default template’s groups –> index.php file in my child theme, replacing this:
<h3><?php _e( ‘Groups Directory’, ‘buddypress’ ) ?><?php if ( is_user_logged_in() ) : ?> Â “><?php _e( ‘Create a Group’, ‘buddypress’ ) ?><?php endif; ?></h3>
With this:
<h3><?php _e( ‘Groups Directory’, ‘buddypress’ ) ?><?php if ( current_user_can( ‘delete_others_posts’ ) ) : //only admins and editors can see this ?> Â “><?php _e( ‘Create a Group’, ‘buddypress’ ) ?><?php endif; ?></h3>
It worked like a charm! Now only Admins and Editors can create groups on my site.
February 11, 2010 at 8:39 pm #63119Rich SpottParticipantI just did it manually in phpmyadmin, with:
hide_sitewide tinyint(1) default ‘0’,
those settings. It seemed to work fine, no more errors in my logs regarding that. Thank you.
February 11, 2010 at 7:13 am #8774Topic: Hide default BP 1.2 Theme
in forum How-to & TroubleshootingMohd Ridzwan HassanParticipantDoes any one know how to hide default BP 1.2 from appearing in user admin area?
February 10, 2010 at 7:19 pm #63000In reply to: Hide Admin
intimezParticipantI noticed this topic is marked as resolved. How can I enable this?
January 27, 2010 at 5:45 pm #8527do77ParticipantI need to hide ‘all’ content from unregistered users but I am kind of struggling with that. I have already installed the privacy component ( Thanks for suggesting Brajesh) but it only allows each user to set their privacy settings. I can’t hide all content by default as the administrator. I also tried the Members Access plugin but it does not work at all for me and the Members Only plugin unfortunately does not work in combination with Theme my Login It does force you to login to see the page but you can still visit all profiles, groups etc.
Is there a way to hide all content underneath the header and display a login/registration form instead? I believe there is no plugin so far … would that be quite simple to do or does it require major hacks?
Thanks !!
January 26, 2010 at 10:05 pm #8511Topic: Suggestions for the activity component – bp 1.2
in group forum Requests & FeedbackousepParticipantI’m trying out bp trunk, on a wp trunk install. In particular, the activity section.
Is there a way to specify settings on activity? Apart from via the theme files, ie.
For instance, can an admin specify how deep nested replies can go? I’ve tried it out, and after the 10th one or so, it stops making sense for it to continue. In narrower screens, that would stop at 5 or 6, I guess.
Additionally, nesting could be disabled completely, as in the comment settings.
Disable replies on certain activity types – Not every activity needs a discussion. Instead of offering just “Disable activity stream commenting on blog and forum posts?”, split it up and offer this on every activity type, separately.
Limit visible replies to an activity item to the latest (or the earliest) X number, a la facebook. On an active site, replies to activity could take up several scrolls worth of screen space. And if a visitor isn’t interested in that particular topic, the site loses that visitor. The rest of the replies could be shown and re-hidden on demand.
Public replies to activity items: In many cases, updates would be taking the place of blogs, and should replies be limited to only registered users? The onus for moderating public replies can lie with either the the activity author, or the site admins.
Does akismet work on activity replies?
Hide certain activity types from showing on the activity page. Offer everything… let the site admins decide on what they want on the activity streams.
Some of this might already be possible, but if these could be offered in the admin panel under Buddypress, it would make things much easier.
January 24, 2010 at 6:38 pm #6152221cdbParticipantGreat work! I haven’t had the time for a detailed test, but i have some short feadback for the beginning:
1. Everything works fine and seems logical. Thats great. There could be some front-end twaeks, but i will come back later next week with some more detailed ideas and mockups.
2. From our experience it is great to have advanced edit functions but hide them in a second row from the avarage user (like the wordpress backend editor does). For a wiki article the user (students) should focus on the content instead of any fancy formating. Basic options could be a select-box for h1, h2, h3 (this is important and must be easy accessible, because it will build the toc and people should get used to it) bold, italic, url link, unordered list, and numberd list. Everything else could go in a second or third row which appears if you click some “advanced options” button.
3. (future release) A searchable wiki directory page with all public pages.
4. (future release) “Suggest a wiki page” button so that non admin-members could ask the admin to create a new wiki page for them.
5. (future release) non-admin wiki page creation
January 23, 2010 at 4:07 pm #8455w101ParticipantI need to find a permanent solution that would allow me to HIDE user IP addresses and email in the comments, and the backend admin. Really everywhere.
I can manually edit pluggable.php and comment-template.php in the includes folder, but each time I update they invariably are overwritten and I have to do it all over again.
Does anyone know of a plugin for this or have another solution?
Thanks!
I’m trying to limit the private information that is being displayed to anyone that happens to create a blog.
January 19, 2010 at 4:13 pm #61121In reply to: Multiple user types – possible?
BoweParticipantI don’t have a solution for all your problems but assigning different “user” types to your site is easy:
– Create a xprofile field in your BuddyPress admin. For example: What kind of user are you:
a. Swimmer
b. Skater
c. Surfer
– Install the BP Member filter plugin: https://buddypress.org/forums/topic/bp-member-filter
– Users can now filter members on the member directory page to find certain usertypes
The only thing you might want to look into is to show/hide specific xprofile fields for different groups. That’s more advanced and requires some new code to be written by someone
Good luck!
edit: Maybe if you combine both tips from Boris and me you just got your solution
ps: I’m interested in the jquery profile fields stuff as well.. sounds handy!
January 13, 2010 at 3:41 am #60667r-a-yKeymasterThe way I see it, you have a couple of options:
1) Continue using your external bbPress setup for open, public discussions (similar to bp.org/forums), while hiding all group forums and group forum related discussions from your external bbPress install.
BP group forum discussions will now be using the new integrated forums in BP 1.1 only for group discussions. And you can retain all your external bbPress posts!
This essentially means you’ll have two forums.
2) Move everything over to the integrated BuddyPress forums (not something you want to do I’m guessing).
3) Move everything over to the external install of bbPress (requires BP core hacking, doable, but more work).
—
Option 1 is probably the most viable.
Here’s how to do it:
Step #1 (optional, depending on where you installed your external version of bbPress)
By default, BP group forums can be accessed at:
hxxp://example.com/forums/
If your external bbPress is also installed in /forums/, you’ll want to rename BP’s forums slug to something else.
You can do this by adding the following in your wp-config.php or bp-custom.php:
define( 'BP_FORUMS_SLUG', 'group-forums' );
In the example above, your BP forums can now be accessed at hxxp://example.com/group-forums/
Step #2
In your external bbPress install, make sure all your group forums are under a forum category.
If you don’t have a forum category specifically for your group forums, go into your bbPress admin area and add one (you can call the forum category “Group Forums” or whatever you want), then place each group forum under this new category.
Note down the forum ID of the forum category. You can get the forum category ID by mousing over the “Edit” link and checking the “id” parameter.
Step #3
Now that you’ve created a forum category and noted down that forum category ID, we want to hide all group forum related stuff from access and view.
We’re going to be using _ck_’s Hidden Groups plugin to do this.
Since you’re using the BP Groups plugin by Burt Adsit, chances are you’re already using _ck_’s Hidden Forums plugin due to its usage with BP Groups.
Open up the plugin (hidden-forums.php) in a text editor.
Comment out this line:
$hidden_forums['hidden_forums']=array(500,501,502); // hide these forums, list by comma seperated number
Underneath that line, add the following:
$bp_hide_group_forum_category_id = 3;
$hidden_forums['hidden_forums']=array();
$hidden_forums['hidden_forums'][] = $bp_hide_group_forum_category_id;
$forums = get_forums();
foreach ($forums as $forum) {
if ($forum->forum_parent == $bp_hide_group_forum_category_id)
$hidden_forums['hidden_forums'][] = $forum->forum_id;
}Change the $bp_hide_group_forum_category_id variable to the forum category ID you noted down in step #2.
—
And that should be it! By default, the admin can view every single forum post, so try viewing your bbPress install when you’re logged out!
January 1, 2010 at 7:42 pm #59885In reply to: Soon to release bp group control plugin
BorisParticipantsetting up different group types is fairly easy. You just have to attach some groupmeta to the group, that basically let you add as many types as you’d like. Then you just check the metadata to figure out what type of group you’re in. Using the groups API you can then add different functionality for different groups.
I’ve written a types-plugin for one of my sites. It doesn’t have an interface, though. The 3 types I needed are hardcoded into it, so it’s really not suited for a release at the moment. There’s also a lot of more stuff, like a shopping cart, part of that plugin. So, I’ve stripped the functions needed for group types out (hopefully al of them).
First we need to add the addtional fields to our registration form:
function sv_add_registration_group_types()
{
?>
<div id="account-type" class="register-section">
<h3 class="transform"><?php _e( 'Choose your account type (required)', 'group-types' ) ?></h3>
<script type="text/javascript" defer="defer">
jQuery(document).ready(function(){
jQuery("#account-type-normal_user").attr("checked", true);
jQuery("#group-details").hide();
jQuery("#account-type-type_one,#account-type-type_two,#account-type-type_three").click(function(){
if (jQuery(this).is(":checked")) {
jQuery("#group-details").slideDown("slow");
} else {
jQuery("#group-details").slideUp("slow");
}
});
jQuery("#account-type-normal_user").click(function(){
if (jQuery(this).is(":checked")) {
jQuery("#group-details").slideUp("slow");
} else {
jQuery("#group-details").slideDown("slow");
}
});
});
</script>
<?php do_action( 'bp_account_type_errors' ) ?>
<label><input type="radio" name="account_type" id="account-type-normal_user" value="normal_user" checked="checked" /><?php _e( 'User', 'group-types' ) ?></label>
<label><input type="radio" name="account_type" id="account-type-type_one" value="type_one" /><?php _e( 'Type 1', 'group-types' ) ?></label>
<label><input type="radio" name="account_type" id="account-type-type_two" value="type_two" /><?php _e( 'Type 2', 'group-types' ) ?></label>
<label><input type="radio" name="account_type" id="account-type-type_three" value="type_three" /><?php _e( 'Type 3', 'group-types' ) ?></label>
<div id="group-details">
<p><?php _e( 'We will automatically create a group for your business or organization. This group will be tailored to your needs! You can change the description and the news later in the admin section of your group.', 'group-types' ); ?></p>
<?php do_action( 'bp_group_name_errors' ) ?>
<label for="group_name"><?php _e( 'Group Name', 'scuba' ) ?> <?php _e( '(required)', 'buddypress' ) ?></label>
<input type="text" name="group_name" id="group_name" value="" />
<br /><small><?php _e( 'We suggest you use the name of your business or organization', 'group-types' ) ?></small>
<label for="group_desc"><?php _e( 'Group Description', 'scuba' ) ?></label>
<textarea rows="5" cols="40" name="group_desc" id="group_desc"></textarea>
<br /><small><?php _e( 'This description will be visible on your group profile, so it could be used to present your mission statement for example.', 'group-types' ) ?></small>
<label for="group_news"><?php _e( 'Group News', 'scuba' ) ?></label>
<textarea rows="5" cols="40" name="group_news" id="group_news"></textarea>
<br /><small><?php _e( 'Enter any news that you want potential members to see.', 'group-types' ) ?></small>
</div>
</div>
<?php
}
add_action( 'bp_before_registration_submit_buttons', 'sv_add_registration_group_types' );Then we have to validate things and add some usermeta when a regitration happens:
/**
* Add custom userdata from register.php
* @since 1.0
*/
function sv_add_to_signup( $usermeta )
{
$usermeta['account_type'] = $_POST['account_type'];
if( isset( $_POST['group_name'] ) )
$usermeta['group_name'] = $_POST['group_name'];
if( isset( $_POST['group_desc'] ) )
$usermeta['group_desc'] = $_POST['group_desc'];
if( isset( $_POST['group_news'] ) )
$usermeta['group_news'] = $_POST['group_news'];
return $usermeta;
}
add_filter( 'bp_signup_usermeta', 'sv_add_to_signup' );
/**
* Update usermeta with custom registration data
* @since 1.0
*/
function sv_user_activate_fields( $user )
{
update_usermeta( $user['user_id'], 'account_type', $user['meta']['account_type'] );
if( isset( $user['meta']['group_name'] ) )
update_usermeta( $user['user_id'], 'group_name', $user['meta']['group_name'] );
if( isset( $user['meta']['group_desc'] ) )
update_usermeta( $user['user_id'], 'group_desc', $user['meta']['group_desc'] );
if( isset( $user['meta']['group_news'] ) )
update_usermeta( $user['user_id'], 'group_news', $user['meta']['group_news'] );
return $user;
}
add_filter( 'bp_core_activate_account', 'sv_user_activate_fields' );
/**
* Perform checks for custom registration data
* @since 1.0
*/
function sv_check_additional_signup()
{
global $bp;
if( empty( $_POST['account_type'] ) )
$bp->signup->errors['account_type'] = __( 'You need to choose your account type', 'group-types' );
if( empty( $_POST['group_name'] ) && $_POST['account_type'] != 'normal_user' )
$bp->signup->errors['group_name'] = __( 'You need to pick a group name', 'group-types' );
if( ! empty( $_POST['group_name'] ) && $_POST['account_type'] != 'normal_user' )
{
$slug = sanitize_title_with_dashes( $_POST['group_name'] );
$exist = groups_check_group_exists( $slug );
if( $exist )
$bp->signup->errors['group_name'] = __( 'This name is not available. If you feel this is a mistake, please <a href="/contact">contact us</a>.', 'group-types' );
}
}
add_action( 'bp_signup_validate', 'sv_check_additional_signup' );And then we set up the group for the user (there are some constants in this function, so you’ll need to change that):
/**
* Create custom groups for skools, biz and org accounts
* @since 1.0
*/
function sv_init_special_groups( $user )
{
global $bp;
// get account type
$type = get_usermeta( $user['user_id'], 'account_type' );
if( $type == 'normal_user' )
{
// Do nothing
}
elseif( $type == 'type_one' || $type == 'type_two' || $type == 'type_three' )
{
// get some more data from sign up
$group_name = get_usermeta( $user['user_id'], 'group_name' );
$group_desc = get_usermeta( $user['user_id'], 'group_desc' );
$group_news = get_usermeta( $user['user_id'], 'group_news' );
$slug = sanitize_title_with_dashes( $group_name );
// create dive skool group
$group_id = groups_create_group( array(
'creator_id' => $user['user_id'],
'name' => $group_name,
'slug' => $slug,
'description' => $group_desc,
'news' => $group_news,
'status' => 'public',
'enable_wire' => true,
'enable_forum' => true,
'date_created' => gmdate('Y-m-d H:i:s')
)
);
// add the type to our group
groups_update_groupmeta( $group_id, 'group_type', $type );
// delete now useless data
delete_usermeta( $user['user_id'], 'group_name' );
delete_usermeta( $user['user_id'], 'group_desc' );
delete_usermeta( $user['user_id'], 'group_news' );
// include PHPMailer
require_once( SV_MAILER . 'class.phpmailer.php' );
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = SV_SMTP;
$auth = get_userdata( $user['user_id'] );
$profile_link = $bp->root_domain . '/' . $bp->groups->slug . '/' . $slug . '/admin';
$message = sprintf( __( 'Hello %s,
we have created a group for your business or organization. To get more out of your presence on Yoursitenamehere please take some time to set it up properly.
Please follow this link to fill in the rest of your profile: %s
We wish you all the best. Should you have any questions regarding your new group, please contact us at support@yoursitenamehere.com.
Your Yoursitenamehere Team', 'group-types' ), $auth->display_name, $profile_link );
$mail->SetFrom("support@yoursitenamehere.com","Yoursitenamehere");
$mail->AddAddress( $auth->user_email );
$mail->Subject = __( 'Your new group pages on Yoursitenamehere', 'group-types' );
$mail->Body = $message;
$mail->WordWrap = 75;
$mail->Send();
}
}
add_action( 'bp_core_account_activated', 'sv_init_special_groups' );When you write a group extension we’ll have to swap the activation call with a function like the one below to be able to check for group types.
/**
* Replacement activation function for group extension classes
*/
function activate_type_one()
{
global $bp;
$type = groups_get_groupmeta( $bp->groups->current_group->id, 'group_type' );
if( $type == 'type_one' )
{
$extension = new Group_Type_One;
add_action( "wp", array( &$extension, "_register" ), 2 );
}
}
add_action( 'plugins_loaded', 'activate_type_one' );The last thing we need to do is add our group type names to group and directory pages:
/**
* Modify the group type status
*/
function sv_get_group_type( $type, $group = false )
{
global $groups_template;
if( ! $group )
$group =& $groups_template->group;
$gtype = groups_get_groupmeta( $group->id, 'group_type' );
if( $gtype == 'type_one' )
$name = __( 'Type 1', 'group-types' );
elseif( $gtype == 'type_two' )
$name = __( 'Type 2', 'group-types' );
elseif( $gtype == 'type_three' )
$name = __( 'Type 3', 'group-types' );
else
$name = __( 'User Group', 'group-types' );
if( 'public' == $group->status )
{
$type = sprintf( __( "%s (public)", "group-types" ), $name );
}
elseif( 'hidden' == $group->status )
{
$type = sprintf( __( "%s (hidden)", "group-types" ), $name );
}
elseif( 'private' == $group->status )
{
$type = sprintf( __( "%s (private)", "group-types" ), $name );
}
else
{
$type = ucwords( $group->status ) . ' ' . __( 'Group', 'buddypress' );
}
return $type;
}
add_filter( 'bp_get_group_type', 'sv_get_group_type' );
/**
* Modify the group type status on directory pages
*/
function sv_get_the_site_group_type()
{
global $site_groups_template;
return sv_get_group_type( '', $site_groups_template->group );
}
add_filter( 'bp_get_the_site_group_type', 'sv_get_the_site_group_type' );It’s quite a bit of code, but it should get you started. This hasn’t been tested with 1.2 btw.
December 10, 2009 at 10:27 pm #58439In reply to: Group Wiki Plugin (not a release, but in progress)
D CartwrightParticipant@Boone Gorges
Initially I wanted to have the wiki pages privacy completely controlled by the group privacy level but unfortunately we have a need to be able to ‘unhide’ individual wiki pages so in the implementation we’re working on pages will be individually controlled via the group wiki admin page.
As stated above, I completely agree. Whilst the work we’re doing at the moment will involve mediawiki I think it’s highly likely that I’ll simultaneously (though at a much slower pace) work on something similar to you’re describing in your last post.
-
AuthorSearch Results