Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'custom activity page'

Viewing 25 results - 601 through 625 (of 1,252 total)
  • Author
    Search Results
  • #166344
    bp-help
    Participant

    @famous
    Try this just make sure you follow the instructions in the commented code. Place it in bp-custom.php :

    
    /* Redirects to profile upon login, and upon logout redirects to activity page unless changed */
    function bp_help_redirect_to_profile(){
     global $bp_unfiltered_uri;
    
     $bphelp_my_front_page = 'activity';  // WARNING: make sure you replace 'activity' in this line to the same thing you set dashboard/settings/reading front page to.
    
     if ( !is_user_logged_in() && ( $bp_unfiltered_uri[0] != $bphelp_my_front_page ) ) 
      bp_core_redirect( get_option('home') );
    
     elseif( is_user_logged_in() && ( $bp_unfiltered_uri[0] == $bphelp_my_front_page ) )
    	bp_core_redirect( get_option('home') . '/members/' . bp_core_get_username( bp_loggedin_user_id() ) . '/profile' );
    
    }
    	
    add_action( 'wp', 'bp_help_redirect_to_profile', 3 );
    
    #166341
    bp-help
    Participant

    @famous
    Try this just make sure you follow the instructions in the commented code. Place it in bp-custom.php :

    
    /* Redirects to profile upon login, and upon logout redirects to activity page unless changed in line 6 */
    function bp_help_redirect_to_profile(){
     global $bp_unfiltered_uri;
    
     $bphelp_my_home_page = 'activity';  // WARNING: make sure you replace 'activity' in this line to the same thing you set dashboard/settings/reading front page to.
    
     if ( !is_user_logged_in() && ( $bp_unfiltered_uri[0] != $bphelp_my_home_page ) ) 
      bp_core_redirect( get_option('home') );
    
     elseif( is_user_logged_in() && ( $bp_unfiltered_uri[0] == 'activity') )
    	bp_core_redirect( get_option('home') . '/members/' . bp_core_get_username( bp_loggedin_user_id() ) . '/profile' );
    
    }
    	
    add_action( 'wp', 'bp_help_redirect_to_profile', 3 );
    
    #166287

    In reply to: [Resolved] BuddyBlog?

    ldjautobody
    Participant

    Yessssss! Thanks @andrewteg! I was seriously beginning to think I dreamed the whole thing up…not sure why I could not find this page, but that is EXACTLY where I was.

    Now, since I have found what I was looking for, I’d really like to get some opinions of the plugin and see if this will actually do what I am planning for this site. I am open to all opinions and suggestions. My understanding of BuddyPress and bbPress is coming along and the site is starting to look like what I envisioned. You can see the preliminary site at http://accessories.ldjautobody.com.

    First, let me explain what I have planned for this site and, like I said, I am open to all suggestions and comments. I would like to hear what the experts have to say. Good or bad, I need your opinions. You ALL have great ideas and I respect whatever you might have to say or add. ๐Ÿ™‚

    This blog and forum are dedicated to custom car and motorcycle enthusiasts everywhere. Car enthusiasts are passionate about their subject, and in addition to giving them a place to share their projects and discuss those among each other, I would also like to let them post some articles, hoping that the fresh content will keep the search engines hanging out on the site and help boost the rankings. I have never run a forum site or used BuddyPress or bbPress before and I’m not really sure how this all works in relation to SEO. I do, however, deal with car and motorcycle enthusiasts on a daily basis and I know that I can most likely count on them to get some very good discussions going among themselves and that is my hope for this site.

    We will also be doing some affiliate marketing from this site, and my hope is that in a perfect World, the fresh content and activity level of the site will keep us ranking well in the search engines and bring some new customers to the site. Since we are an “auto body shop”, our normal advertising is concentrated in a very local area. The affiliate site, however, will have a much broader range and we will be advertising nationwide vs. the small local area that the body shop is limited to. So my hope is that the increased activity on the site will increase the number of people visiting and also help us reach out well beyond our local area. At least, that is our goal for now!

    Thank you all again for all of your help. I am looking forward to hearing anything my experts have to add as we move forward with getting the site ready to launch. ๐Ÿ™‚

    Denise

    #166146
    mahdiar
    Participant

    I put an !important at the end and it works .
    Thanks Hugo

    #166143
    mahdiar
    Participant

    Even I change the style of all spans ( span{} ) but it doesn’t work .
    I found this in frisco theme :
    div.item-list-tabs ul li a span {}
    It doesn’t work neither !

    #166130
    Hugo Ashmore
    Participant

    At what point is that ruleset appearing in the cascade? This is likely an issue of selector weight, try putting an id in that selector set, an id that is a parent of one of those elements.

    #166107
    mahdiar
    Participant

    Thanks but none of them works ! I use this css code:

     .item-list-tabs li a span {
    color:red;
    font-size:20px;
    background-color:orange;
    }
    #166105
    Hugo Ashmore
    Participant

    And what solution were you looking for?

    I found the styles in seconds using Firebug:

    #friends-personal-li a span {}

    or:
    .item-list-tabs li a span {}
    if you want to catch all the span numbers across bp screens nav

    #166103
    mahdiar
    Participant

    Hi

    There is a number next to the friend tab that shows number of friends and other tabs .

    I’d like to add some custom styles to them . I use inspect feature in firefox but I couldn’t find the solution.

    rcain
    Participant

    @bp-help

    good suggestions. thx. 2 of them r new to me, so other people may find them helpful also.

    on our sites we r using::

    Keith Graham’s most excellent ‘stop-spammer-registrations-plugin’ – https://wordpress.org/plugins/stop-spammer-registrations-plugin/

    – has stopped over 53,000 spammers since feb this year! it uses external lookups on StopForumSpam, ProjectHoneyPot, BotScout, (Akismet, which we dont use), others – thus great collective benefit/advance warning of bad traffic. also traps brute force attacks (bad logins/registrations/comment posts, etc), etc. is simple enough to play nice with most plugins.

    to try & keep as much load off the front-end of the server as possible, we also have set up:

    linux iptables ( & ufw add on )- as the basis of all firewall stuff. also has our manually maintained blacklists & whitelists. various custom rule chains setup. takes a while to get your head around, but is essential.

    linux fail2ban – essentially an add on to iptables, puts people in jail for bad behaviour – eg: brute force attacks against ssh, ftp, mail logins. we also have set up custom rules detecting bad activity against wp-login.php itself via fail2ban. am looking to do some more with this.

    linux apache – mod-security2, libapache2-mod-evasive, libapache2-mod-antiloris, libapache2mod-spamhaus – which help protect against general bad behaviour, DDOS, blank header attacks, the infamous ‘Loris’ script (which we’ve experienced!), and bot-nets. still assessing how effective these r.

    we have also had to tune apache on our VPS for resilience in the face of DDOS type attacks and heavy-handed brute force attacks.

    some further good tips here: http://www.dannytsang.co.uk/index.php/apache-2-hardening-tips/ & elsewhere.

    linux logwatch – reports various access stats (the good & the bad & the ugly) via email – very useful indeed for checking whther situation is under control (or not).

    linux rkhunter – scans for rootkits on the server from time to time – just be sure – & particularly useful if u ever do get infected in hunting down the intruder’s code.

    obviously we also have file system bolted down. (there is a good wp plugin to check permissions bolt-down, i forget what its called). we also spend a LONG time analysing logs etc.

    anway, that takes care of many of the bad boys, but we r still left with the following problems to crack:

    1) we have observed that many bad bots/scripts are exhibiting ‘learning behaviour’ (ie. heuristic) and r finding ways around fail2ban rules/jails, etc. in particular:

    a) rotating IP addresses to match ‘ban counts’ – currently we have them wasting an IP address every 3-4 attempts, but they still seem to have an inexhaustable supply, else are spoofing extreamly well.

    b) varying their retry period to match the length of jail sentence. (ie. they are not wasting their mips whilst in jail, just enough to detect when they are released,record it, and tune their future responses).

    2) content scrapers, probes and bad-bots generally – these r wasting enormous resource on our servers. typically i would suggest such ‘bad traffic’ is responsible for over 50% of total server load (ie. not good at peak times on a busy site). additional problems we r facing here:

    a) bad bots often spoof the agent string to pretend to be eg. google, bing, etc. the only way u can tell is by reverse lookup of ip address and try and match to one of well known range of ‘good bot’ addresses. but, despite fact that many ranges are well known, most of them are never actually published or confirmed, many are variable. i am not aware of any definitve list of ip addresses of good bots (though there is http://www.iplists.com/ whichis not bad, & http://www.webmasterworld.com/search_engine_spiders/ which is often helpful – these are very much ‘best efforts/as seen in the wild’ lists.). this problem worsens with the rise of social network agregation services, other (legitimate) content agregators, and personal content aggregating software on mobiles, tablets, etc.

    idea: i am thinking of writing a script/plugin/rule to do smart lookup of ip against good bots list, & to automatically maintain that (collective) list. ideally, this is a service that someone like spamhause, or projecthoneypot should offer, since they already have the infrastructure. but, we’ll see. the script will detect traffic ‘purporting to be a SE bot, of any kind and to ban it via iptables if it isnt in the approved list/doesnt check out. the risk is in false positives and harming ones SEO. anyone any thought in this area?

    b) probes & sniffers hunting out wp/bp forms, ajax ports, plugin files, forms, etc – in advance of main attack by penatration/spamming bots. typically always use swiftly rotated ip’s. many many variants out there. usually they have no luck on our sites, but that does not stop them trying in vast numbers (bot-nets, collectives? hives?) and harming out response times, etc.

    idea: url obfuscation has been brought up on this forum before, particularly for eg: login, registration, admin url’s, etc. i am thinking of creating a plugin to dynamically hash encode links of choice using someething based on wp forms nonce system. not only useful for causing probes & hackers pain, but also to help thwart media thieves. obviously, scripters will soon respond by just snanning for link titles in html, so not bullet proof in any way, but they will at least be on 1-time request code, so causing them page reload every request & less sophisticted scripts will be totally wasting their own time.

    anyway. these have been my thought so far. would love to hear experience/insights of others.

    unfortuntely wordpress & buddypress sites in particular represent the richest of prizes for hackers, content scrapers, spammers, etc – & they r really on our case. furthermore, there is some BIG money involved, from porn to pharma to credit card fraud; that means some very smart programmers being paid excellent rates, to hack our systems, full time. add to that, the 10’s of millions of infected machines out there (often unknowingly) operating as botnet drones, trying to pernetrate our servers 24×7, steal our machine resources and steal our members personal data. it is a war of attrition.

    all further experience, ideas welcome, here.

    #165893
    synfrag
    Participant

    Hello All,

    I’m having an issue on a custom Buddypress theme. On my activity feed, whenever a tab is clicked it pops open the comment form for every entry on the feed. If I refresh the page it hides them again.

    I am using the BP Template Pack plugin with the JS/Ajax left on. If I turn that off they are always there on every entry.

    If anyone has any insight I’d appreciate it.

    Versions:
    WP v3.5.1
    BP v1.7
    BBP v 2.3.2

    Thanks,
    Charles

    #165835
    bp-help
    Participant

    @ghera74
    That is default behavior if you do not have an private community type plugins activated. You can make activity your landing page in dashboard/settings/reading or create a custom menu and add the activity page as a menu item if you don’t want it as a landing page:
    https://codex.buddypress.org/user/setting-up-a-new-installation/how-to-set-up-your-main-site-navigation-using-the-built-in-wordpress-menus/
    Either way the activity stream is visible to logged-out-users, they just can’t post or comment.

    #165801

    In reply to: Custom Activity Page

    Daniel Lemes
    Participant

    Well, i don’t know how i didn’t think about it before. Pretty simple, just changing the function which gets the slug. So:

    function the_slug() {
        $post_data = get_post($post->ID, ARRAY_A);
        $slug = $post_data['post_name'];
    	$slug = str_replace(array('-'),' ',$slug);
    	return $slug; 
    }

    It gives me the slug as nice filtering terms like “chrono trigger” (space instead of -). If the page slug is “chrono-trigger-snes” i still having a problem, but i will use another string replace to get rid of this.

    Any suggestion or opinion about performance (other faster/lighter way)?

    #165800
    Daniel Lemes
    Participant

    Hello! First, what i’m using:

    • WP: 3.6 beta3
    • BP: 1.7.2
    • BBPress: 2.3.2
    • Theme: default theme (child)

    What i’m trying to do is create a custom template to load activities filtered by terms. So, i taked code from activity-loop.php to create a new “custom.php” file, put it on template root and create a new page using this template.

    This is the content of my custom template for pages. Sorry if it’s too long, it’s the same content of activity-loop.php, except on “activity” div:

    <?php
    /**
    * Template Name: Games
    */
    
    get_header( 'buddypress' ); ?>
    <?php do_action( 'bp_before_directory_activity_page' ); ?>
    	<div id="content">
    		<div class="padder">
    			<?php do_action( 'bp_before_directory_activity' ); ?>
    			<?php if ( !is_user_logged_in() ) : ?>
    			<h3><?php _e( 'Site Activity', 'buddypress' ); ?></h3>
    			<?php endif; ?>
    			<?php do_action( 'bp_before_directory_activity_content' ); ?>
    			<?php if ( is_user_logged_in() ) : ?>
    			<?php locate_template( array( 'activity/post-form.php'), true ); ?>
    			<?php endif; ?>
    			<?php do_action( 'template_notices' ); ?>
    			<div class="item-list-tabs activity-type-tabs" role="navigation">
    			<ul>
    			<?php do_action( 'bp_before_activity_type_tab_all' ); ?>
    
    			<li class="selected" id="activity-all"><a href="<?php bp_activity_directory_permalink(); ?>" title="<?php _e( 'The public activity for everyone on this site.', 'buddypress' ); ?>"><?php printf( __( 'All Members <span>%s</span>', 'buddypress' ), bp_get_total_member_count() ); ?></a></li>
    
    		<?php if ( is_user_logged_in() ) : ?>
    		<?php do_action( 'bp_before_activity_type_tab_friends' ); ?>
    		<?php if ( bp_is_active( 'friends' ) ) : ?>
    		<?php if ( bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?>
    
    		<li id="activity-friends"><a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/'; ?>" title="<?php _e( 'The activity of my friends only.', 'buddypress' ); ?>"><?php printf( __( 'My Friends <span>%s</span>', 'buddypress' ), bp_get_total_friend_count( bp_loggedin_user_id() ) ); ?></a></li>
    
    		<?php endif; ?>
    		<?php endif; ?>
    		<?php do_action( 'bp_before_activity_type_tab_groups' ); ?>
    		<?php if ( bp_is_active( 'groups' ) ) : ?>
    		<?php if ( bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) : ?>
    
    		<li id="activity-groups"><a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/'; ?>" title="<?php _e( 'The activity of groups I am a member of.', 'buddypress' ); ?>"><?php printf( __( 'My Groups <span>%s</span>', 'buddypress' ), bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ); ?></a></li>
    
    	<?php endif; ?>
    	<?php endif; ?>
    	<?php do_action( 'bp_before_activity_type_tab_favorites' ); ?>
    
    	<?php if ( bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) : ?>
    
    	<li id="activity-favorites"><a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/favorites/'; ?>" title="<?php _e( "The activity I've marked as a favorite.", 'buddypress' ); ?>"><?php printf( __( 'My Favorites <span>%s</span>', 'buddypress' ), bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ); ?></a></li>
    
    	<?php endif; ?>
    	<?php do_action( 'bp_before_activity_type_tab_mentions' ); ?>
    
    	<li id="activity-mentions"><a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/'; ?>" title="<?php _e( 'Activity that I have been mentioned in.', 'buddypress' ); ?>"><?php _e( 'Mentions', 'buddypress' ); ?><?php if ( bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) : ?> <strong><?php printf( __( '<span>%s new</span>', 'buddypress' ), bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ); ?></strong><?php endif; ?></a></li>
    
    	<?php endif; ?>
    
    	<?php do_action( 'bp_activity_type_tabs' ); ?>
    	</ul>
    	</div><!-- .item-list-tabs -->
    
    	<div class="item-list-tabs no-ajax" id="subnav" role="navigation">
    	<ul>
    	<li class="feed"><a href="<?php bp_sitewide_activity_feed_link(); ?>" title="<?php _e( 'RSS Feed', 'buddypress' ); ?>"><?php _e( 'RSS', 'buddypress' ); ?></a></li>
    
    	<?php do_action( 'bp_activity_syndication_options' ); ?>
    	<li id="activity-filter-select" class="last">
    	<label for="activity-filter-by"><?php _e( 'Show:', 'buddypress' ); ?></label>
    	<select id="activity-filter-by">
    	<option value="-1"><?php _e( 'Everything', 'buddypress' ); ?></option>
    	<option value="activity_update"><?php _e( 'Updates', 'buddypress' ); ?></option>
    
    	<?php if ( bp_is_active( 'blogs' ) ) : ?>
            <option value="new_blog_post"><?php _e( 'Posts', 'buddypress' ); ?></option>
    	<option value="new_blog_comment"><?php _e( 'Comments', 'buddypress' ); ?></option>
    
    	<?php endif; ?>
    
    	<?php if ( bp_is_active( 'forums' ) ) : ?>
    
    	<option value="new_forum_topic"><?php _e( 'Forum Topics', 'buddypress' ); ?></option>
    	<option value="new_forum_post"><?php _e( 'Forum Replies', 'buddypress' ); ?></option>
    
    	<?php endif; ?>
    	<?php if ( bp_is_active( 'groups' ) ) : ?>
    	<option value="created_group"><?php _e( 'New Groups', 'buddypress' ); ?></option>
    	<option value="joined_group"><?php _e( 'Group Memberships', 'buddypress' ); ?></option>
    	<?php endif; ?>
    	<?php if ( bp_is_active( 'friends' ) ) : ?>
    	<option value="friendship_accepted,friendship_created"><?php _e( 'Friendships', 'buddypress' ); ?></option>
    
    	<?php endif; ?>
    	<option value="new_member"><?php _e( 'New Members', 'buddypress' ); ?></option>
    
    	<?php do_action( 'bp_activity_filter_options' ); ?>
    
    	</select>
    	</li>
    	</ul>
    	</div><!-- .item-list-tabs -->
    
    	<?php do_action( 'bp_before_directory_activity_list' ); ?>
    
    <div class="activity" role="main">
    <?php
    $myslug = the_slug();
    
    if ( bp_has_activities('search_terms='.$myslug.'') ) : do_action( 'bp_before_activity_loop' ); 
    /*if ( bp_has_activities( bp_ajax_querystring( 'activity' ) ) ) : */
    /* Show pagination if JS is not enabled, since the "Load More" link will do nothing */ ?>
    	<noscript>
        <div class="pagination">
        <div class="pag-count"><?php bp_activity_pagination_count(); ?></div>
        <div class="pagination-links"><?php bp_activity_pagination_links(); ?></div>
        </div>
        </noscript>
        
    	<?php if ( empty( $_POST['page'] ) ) : ?>
    	<ul id="activity-stream" class="activity-list item-list">
    	<?php endif;
    	while ( bp_activities() ) : bp_the_activity(); 
    	locate_template( array( 'activity/entry.php' ), true, false ); 
    	endwhile;
    	if ( bp_activity_has_more_items() ) : ?>
    
    	<li class="load-more">
    	<a href="#more"><?php _e( 'Load More', 'buddypress' ); ?></a>
    	</li>
    
    	<?php endif; 
    	if ( empty( $_POST['page'] ) ) : ?>
    	</ul>
    	<?php endif;
    	
    	else : ?>
    	<div id="message" class="info">
    	<p><?php _e( 'Sorry, there was no activity found. Please try a different filter.', 'buddypress' ); ?></p>
    	</div>
    
    	<?php endif;
    	do_action( 'bp_after_activity_loop' ); ?>
    	<form action="" name="activity-loop-form" id="activity-loop-form" method="post">
    	<?php wp_nonce_field( 'activity_filter', '_wpnonce_activity_filter' ); ?>
    	</form>
    
    </div><!-- .activity -->
    
    	<?php do_action( 'bp_after_directory_activity_list' ); ?>
    	<?php do_action( 'bp_directory_activity_content' ); ?>
    
    	<?php do_action( 'bp_after_directory_activity_content' ); ?>
    	<?php do_action( 'bp_after_directory_activity' ); ?>
    	</div><!-- .padder -->
    	</div><!-- #content -->
    	<?php do_action( 'bp_after_directory_activity_page' ); ?>
    <?php get_sidebar( 'buddypress' ); ?>
    <?php get_footer( 'buddypress' ); ?>

    My idea is to load different stream for each game, so the page “Chrono Trigger (SNES)” would load activities containing terms like “Chrono Trigger”. I don’t know the best way to do this, so tried to get page slug and use as filter:

    $myslug = the_slug(); // using a function to get slug
    
    if ( bp_has_activities('search_terms='.$myslug.'') ) : do_action( 'bp_before_activity_loop' ); 
    /*if ( bp_has_activities( bp_ajax_querystring( 'activity' ) ) ) : */
    /* Show pagination if JS is not enabled, since the "Load More" link will do nothing */ ?>
    	<noscript>
        <div class="pagination">
        <div class="pag-count"><?php bp_activity_pagination_count(); ?></div>
        <div class="pagination-links"><?php bp_activity_pagination_links(); ?></div>
        </div>
        </noscript>
        
    	<?php if ( empty( $_POST['page'] ) ) : ?>
    	<ul id="activity-stream" class="activity-list item-list">
    	<?php endif;
    	while ( bp_activities() ) : bp_the_activity(); 
    	locate_template( array( 'activity/entry.php' ), true, false ); 
    	endwhile;
    	if ( bp_activity_has_more_items() ) : ?>
    
    	<li class="load-more">
    	<a href="#more"><?php _e( 'Load More', 'buddypress' ); ?></a>
    	</li>
    
    	<?php endif; 
    	if ( empty( $_POST['page'] ) ) : ?>
    	</ul>
    	<?php endif;
    	
    	else : ?>
    	<div id="message" class="info">
    	<p><?php _e( 'Sorry, there was no activity found. Please try a different filter.', 'buddypress' ); ?></p>
    	</div>
    
    	<?php endif;
    	do_action( 'bp_after_activity_loop' ); ?>
    	<form action="" name="activity-loop-form" id="activity-loop-form" method="post">
    	<?php wp_nonce_field( 'activity_filter', '_wpnonce_activity_filter' ); ?>
    	</form>
    
    </div><!-- .activity -->

    This is the function to get slug:

    function the_slug() {
        $post_data = get_post($post->ID, ARRAY_A);
        $slug = $post_data['post_name'];
        return $slug; 
    }

    It works, but only with pages containing the very same slug (for example, if the slug is “Chrono”, it gets all activities with Chrono, but “chrono-trigger” don’t work). There is a better approach to filter this activity stream, i suppose my method is a mess.
    I’m begginer with Buddypress so any help is appreciated.

    #165654
    P
    Participant

    The problem is I need to modify the core files and add a plugin at the same time so a user can change the Throttling settings in his WordPress backend.

    I really tried to simple write a plugin and skip the core files modifications, but it’s just not working out. Maybe you can help out here, I will post the 3 core file functions which I modified as well as the plugin code which I wrote. If you can figure out a way for me to not modify the core files and still get Throttling to work, share your code.

    Modified files:

    1- bp-activity\bp-activity-functions.php

    function bp_activity_post_update( $args = '' ) {
    	global $bp;
    
    	$defaults = array(
    		'content' => false,
    		'user_id' => bp_loggedin_user_id()
    	);
    	$r = wp_parse_args( $args, $defaults );
    	extract( $r, EXTR_SKIP );
    
    	if ( empty( $content ) || !strlen( trim( $content ) ) )
    		return false;
    
    	if ( bp_is_user_inactive( $user_id ) )
    		return false;
    
    	<strong>$floodTest = bp_core_check_for_flood ($user_id);
    	
    	if (!$floodTest)
    		return "flood";</strong>
    
    	// Record this on the user's profile
    	$from_user_link   = bp_core_get_userlink( $user_id );
    	$activity_action  = sprintf( __( '%s posted an update', 'buddypress' ), $from_user_link );
    	$activity_content = $content;
    	$primary_link     = bp_core_get_userlink( $user_id, false, true );
    
    	// Now write the values
    	$activity_id = bp_activity_add( array(
    		'user_id'      => $user_id,
    		'action'       => apply_filters( 'bp_activity_new_update_action', $activity_action ),
    		'content'      => apply_filters( 'bp_activity_new_update_content', $activity_content ),
    		'primary_link' => apply_filters( 'bp_activity_new_update_primary_link', $primary_link ),
    		'component'    => $bp->activity->id,
    		'type'         => 'activity_update'
    	) );
    
    	$activity_content = apply_filters( 'bp_activity_latest_update_content', $content );
    
    	// Add this update to the "latest update" usermeta so it can be fetched anywhere.
    	bp_update_user_meta( bp_loggedin_user_id(), 'bp_latest_update', array( 'id' => $activity_id, 'content' => $content ) );
    
    	do_action( 'bp_activity_posted_update', $content, $user_id, $activity_id );
    
    	return $activity_id;
    }
    

    2- bp-core\bp-core-moderation.php

    function bp_core_check_for_flood( $user_id = 0 )
    {	
    	<strong>// Option disabled. No flood checks.
    	if ( !$throttle_time = bp_get_option( 'bt_activity_time' ) )
    		return false;
    	
    	// Bail if no user ID passed
    	if ( !$user_id )
    		return false;
    
    	$last_posted = get_user_meta( $user_id, '_bp_last_posted', true );
    	
    	if ( !$last_posted )
    	{		
    		$last_posted = time();
    		add_user_meta( $user_id, '_bp_last_posted', $last_posted);
    		return true;
    	}
    	else
    	{	
    		if ( ( time() < ( $last_posted + $throttle_time ) ) && !current_user_can( 'throttle' ) )
    		{
    			update_user_meta($user_id,'_bp_last_posted',time());
    			return false;
    		}
    		else
    		{
    			update_user_meta($user_id,'_bp_last_posted',time());
    			return true;
    		}
    	}</strong>
    }

    3- bp-themes\bp-default\_inc\ajax.php

    function bp_dtheme_post_update() {
    	// Bail if not a POST action
    	if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
    		return;
    
    	// Check the nonce
    	check_admin_referer( 'post_update', '_wpnonce_post_update' );
    
    	if ( ! is_user_logged_in() )
    		exit( '-1' );
    
    	if ( empty( $_POST['content'] ) )
    		exit( '-1<div id="message" class="error"><p>' . __( 'Please enter some content to post.', 'buddypress' ) . '</p></div>' );
    
    	$activity_id = 0;
    	if ( empty( $_POST['object'] ) && bp_is_active( 'activity' ) ) {
    		$activity_id = bp_activity_post_update( array( 'content' => $_POST['content'] ) );
    
    	} elseif ( $_POST['object'] == 'groups' ) {
    		if ( ! empty( $_POST['item_id'] ) && bp_is_active( 'groups' ) )
    			$activity_id = groups_post_update( array( 'content' => $_POST['content'], 'group_id' => $_POST['item_id'] ) );
    
    	} else {
    		$activity_id = apply_filters( 'bp_activity_custom_update', $_POST['object'], $_POST['item_id'], $_POST['content'] );
    	}
    
    	if ($activity_id == "flood")
    	{
    		$bt_activity_throttle_time = bp_get_option ('bt_activity_time');
    		$bt_activity_message = bp_get_option( "bt_activity_message" );
    		
    		$msg = ( $bt_activity_message ) ? $bt_activity_message : "You have to wait to post again";
    		
    		exit( '-1<div id="message" class="error"><p>' . __( $msg, 'buddypress' ) . '</p></div>' );
    	}
    
    	if ( empty( $activity_id ) )
    		exit( '-1<div id="message" class="error"><p>' . __( 'There was a problem posting your update, please try again.', 'buddypress' ) . '</p></div>' );
    
    	if ( bp_has_activities ( 'include=' . $activity_id ) ) {
    		while ( bp_activities() ) {
    			bp_the_activity();
    			locate_template( array( 'activity/entry.php' ), true );
    		}
    	}
    
    	exit;
    }

    4- The Buddypress Throttling Plugin Code

    <?php
    add_action( 'admin_menu', 'plugin_menu' );
    
    function plugin_menu() {
    	// add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function);
    	add_options_page( 'Buddypress Throttling | Settings', 'Buddypress Throttling', 'manage_options', 'buddypress_throttling', 'buddypress_throttling_options' );
    }
    
    function buddypress_throttling_options() {
    
        //must check that the user has the required capability 
        if (!current_user_can('manage_options')) {
         	WP_die( __('You do not have sufficient permissions to access this page.') );
        }
    
        // variables for the field and option names 
        $hidden_field_name = 'submit_hidden';
    
        // See if the user has posted us some information
        // If they did, this hidden field will be set to 'Y'
        if( isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) 
    	{
    		// Activity
    		$bp_activity_time_val =  ( intval($_POST["bt_activity_time"]) <= 0 ) ? 0 : $_POST ["bt_activity_time"];
    		update_option( "bt_activity_time", $bp_activity_time_val );
    		
    		$bp_activity_message_val =  ( isset($_POST["bt_activity_message"]) && $_POST["bt_activity_message"] != "" ) ? $_POST["bt_activity_message"] : "Please wait before posting again";
    		update_option( "bt_activity_message", $bp_activity_message_val );
    		?>
    		
    		<div class="updated"><p><strong><?php _e('Settings saved.', 'menu-test' ); ?></strong></p></div>
    		<?php
    	}
    	
    	// Activity read values
    	$bt_activity_time = get_option( "bt_activity_time" );
    	$bt_activity_time = (intval($bt_activity_time) <= 0) ? 0 : $bt_activity_time;
    	$bt_activity_message = get_option( "bt_activity_message" );
    	$bt_activity_message = ($bt_activity_message) ? $bt_activity_message : "Please wait before posting again";
    	
    	echo '<div class="wrap">';
    		echo "<h2>" . __( 'Buddypress Throttling Settings', 'menu-test' ) . "</h2>";
    		?>
    	
    		<form name="form1" method="post" action="">
    			<input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">	
    			<div class="bt-plugin">
    				<style>
    					.bt-plugin span { display: inline-block; width: 120px; margin-left: 20px }
    					.bt-plugin textarea {width: 400px}
    				</style>
    				<h3><?php _e("On Activity Page: ", 'menu-test' ); ?></h3>
    				<p><span>Throttling Time:</span><input type="text" name="bt_activity_time" value="<?php echo $bt_activity_time; ?>" size="20"> (in seconds)</p>
    				<p><span>Message:</span><textarea name="bt_activity_message" rows="3"><?php echo $bt_activity_message; ?></textarea></p>
    			</div>
    			<p class="submit">
    			<input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
    			</p>
    		</form>
    	</div>
    <?php
    }

    Test it out locally, just replace the specified functions in these files with the functions I wrote, add the plugin code in a php file and save it under your Plugins directory (and activate it in the backend). The Plugin code will allow you to set the number of seconds for throttling as well as the message the user will see when he’s flooding.

    Put this puzzle pieces together and you got Flooding control (for the activity page for now), which can easily be done for friend requests @bphelp).

    Hugo Ashmore
    Participant

    You really need to explain just how you have customised things here. This is the standard members public profile, yet you are displaying a far from standards view, it looks like a mix between activity stream and base profile, and yes it loaded extremely slowly.

    Please explain just what that page shows and how you’re going about doing that as I think people are going to need that information to be able to help in any fashion.

    #165553
    P
    Participant

    @sooskriszta I agree that the plugin is a terrible idea. Throttling is one thing (telling the user “hey slow down a bit”) but setting an absolute limit for the number of friendships goes against the concept of a community.

    Going back to the ORIGINAL point of this topic, I said I will add throttling to the activity page and the friendship requests, but I ran into small trouble and thought maybe some of you people can help out. I opened another topic https://buddypress.org/support/topic/add-custom-setting-to-buddypress-settings/, I appreciate it if you can check it out and help out. @synaptic @sooskriszta

    P
    Participant

    I want to modify the Buddypress core files to add a feature which I need to submit to the trac to be used in future Buddypress releases. This feature lets the user set the the throttling time (in seconds) under Buddypress Settings (wp-admin/admin.php?page=bp-settings), a number which would then be used for preventing flooding on the activity page.

    I added the new throttling setting field next to the other fields but when I enter a number, it just doesn’t save it. However, it does save an option under the wp_options table with my option key but with a value of 0.

    Here’s what I added so far:

    in bp-core-admin.php:

    add_settings_field( 'bp-enable-activity-throttling', __( 'Set Activity Throttling Time', 'buddypress' ), 'bp_admin_setting_callback_activity_throttle', 'buddypress', 'bp_activity' );
    
    register_setting( 'buddypress', 'bp-enable-activity-throttling', 'bp_sanitize_activity_throttling' );

    in bp-core-options.php:

    function bp_sanitize_activity_throttling( $default = 0 ) {
    	return (int) apply_filters( 'bp_sanitize_activity_throttling', (int) bp_get_option( 'bp-enable-activity-throttling', $default ) );
    }

    in bp-core-settings.php:

    function bp_admin_setting_callback_activity_throttle() {
    ?>
    <input id="bp-enable-activity-throttling" name="bp-enable-activity-throttling" type="text" value="<?php bp_form_option( 'bp-enable-activity-throttling', '' ); ?>" />
    <?php
    }

    At the bottom of the bp-core-settings.php file, there’s a function called bp_core_admin_settings_save which gets all fields from the Settings page and saves them. In this function I debugged what the $_POST array was receiving from the Settings page and my setting was there with its value! So the code should have saved my new setting with its value in the wp_options table.

    I got frustrated and tried to debug some more, to no avail.

    Does anyone know how to add my setting to the Buddypress core files?

    shreyachaudhary
    Participant

    Thank you so much @mercime, @naijaping

    The site is back up!

    I’m relatively new to WP/BP. And this experience is making me think about how can I possibly avoid this in future.

    1) Is there a way I can create a backup/mirror image of my site before installing updates? And rollback to that state if anything goes bonkers during installation of updates?

    2) I had relabeled some labels including ‘What’s new, @username?’ to ‘Submit a dream,@username’ in the activity-feed page. After deactivating the buddypress-login-redirect folder, these customizations are gone. Any thoughts on how to fix this would be appreciated!

    Thanks in advance,
    Shreya

    #164582
    Matzze
    Participant

    hi there,

    here’s my question about 1.7.:

    is it possible – like in 1.6 was – to use custom individual full-page-templates for activity, a different for members, a different for groups etc.

    If im remebering right in 1.6. the index.php files in folders activity, grups, memebrs, etc. were full pages. Now index.php is just content in pages content.

    Ok, i can make a page-buddypress.php im templates root, but thts for all lind of template pages i guess.

    How can i change that individually like in 1.6?

    THX

    Matze

    maijavilkina
    Participant

    This is my first child theme, so have mercy ๐Ÿ™‚
    I don’t know what I am doing wrong but when I copy some files over from bp-default to my child theme folder, the theme stops loading buddypress.css and the template it otherwise uses for buddypress pages.

    Page that works right:
    http://oia.innovationskontorett.se/members/maija-vilkina/activity/

    Page that does not work right:
    http://oia.innovationskontorett.se/members/maija-vilkina/ideas/
    or
    http://oia.innovationskontorett.se/members/

    I have copied only the template files I have changed from bp-default to my theme folder and nothing else, and created bp-custom.php for some altered functions.

    How do I get the ‘right’ look to work on all pages? It must be something obvious but I can’t figure out what I am doing wrong.

    —
    WP 3.5.1. BP 1.7.1. Theme built with Roots Boilerplate / Twitter Bootstrap.

    #163779
    bp-help
    Participant

    @marialka
    You could try adding something like this to bp-custom.php :

    
    function bphelp_logged_in_visitor_redirect() {
    global $bp;
    if(is_user_logged_in()) {
    wp_redirect( get_option('siteurl') . '/activity' );
    }
    }
    add_filter('get_header','bphelp_logged_in_visitor_redirect',1);
    

    Just change the line:

    
    wp_redirect( get_option('siteurl') . '/activity' ); 
    

    To:
    `
    wp_redirect( get_option(‘siteurl’) . ‘/members’ );
    ‘
    OR whatever page you want them directed too upon login.

    #163564
    shonesss
    Participant

    Hello, I’ve had a good look in this forum but I don’t see the exact problem I’m having.

    I have an existing wordpress site with a customised theme. I have installed Buddypress as a plugin but the installation wizard does not show up on the top of the page and the set-up tabs are limited. Screen shot here http://tinypic.com/r/4iehkw/5

    The permalink setting is custom

    I thought I’d plough on ahead anyway so I installed Buddypress Template Pack to make it more compatible with the existing theme. It sort of worked. The pages – members, groups, activity – show within the existing template but no buddypress navigation shows so its impossible to use.
    http://tinypic.com/r/ajxnpd/5

    I’ve tried uninstalling everything and reinstalling but the installation wizard doesn’t show leaving the set-up incomplete.

    I cant change the template prior to instal because this will mess with the entire existing site. Any help would be appreciated….

    #163541
    danzigism
    Participant

    Thanks for the info @shanebpdev that is very useful. After using the “Members” role editor I was indeed able to verify that the Manager role already had the “edit_users” capability. Sadly any user with the Manager role still gets taken to the “You do not have sufficient privileges” page. Perhaps it is a bug.

    I checked out the bp-members-functions.php file and found the line you spoke of and it is matching:

    if ( bp_current_user_can( 'bp_moderate' ) || current_user_can( 'edit_users' ) )

    Now “bp_moderate” does not show up as an actual WP role. The regular “moderate” role does however, and the Manager user has access to that capability.

    Just for the heck of it I changed the line to current_user_can(‘Manager’) which without any arguments does check for the name of the role. After doing so I noticed that when a manager goes to edit a member’s profile, they are automatically redirected to the member’s activity feed instead of the edit profile page.

    Something funky is going on for sure. I really appreciate you helping me out with this.

Viewing 25 results - 601 through 625 (of 1,252 total)
Skip to toolbar