Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 5,126 through 5,150 (of 32,571 total)
  • Author
    Search Results
  • #185168
    PinkishHue
    Participant

    Thanks for all the info above. I’ve added the ‘bbPress-Topic-Subscribers’ plugin and that works great.

    To try and do the same for forum subscriptions I’ve copied the files and changed all instances of ‘topic’ to ‘forum’, and it’s listing the users fine, but when you click the unsubscribe link nothing happens.

    Looking at the code, I think it must be something in this section that is not right:

    		$forum_id = bbp_get_forum_id();
    		
    		if ( $forum_id && current_user_can( 'moderate' ) ){
    			$subscribers = bbp_get_forum_subscribers( $forum_id );
    			if ( $subscribers ){
    				echo '<table style="width: 100%">';
    				foreach ( $subscribers as $subscriber ){
    					$subscriber = get_user_by( 'id', $subscriber );
    					echo '<tr>';
    						// avatar
    						echo get_avatar( $subscriber->ID, 45 );
    						echo ' ';
    						//username
    						echo $subscriber->user_login;
    						echo ' ';
    						// remove button
    						echo bbp_get_forum_subscription_link(
    							array(
    								'user_id'     => $subscriber->ID
    							)
    						);

    Specifically maybe the ‘bbp_get_forum_subscription_link’ area? Does anyone have any suggestions on why this wouldn’t work for forums in the same way as topics? Many thanks for any help you can give.

    #185166
    Stagger Lee
    Participant

    Here it is.
    You hijacked topic a bit.
    I still dont understand why you use bbPress as Blog/Posts tool when WordPress is made for this. Almost as you are not so good on theming, and looking for shortcuts.

    – Make own image size
    – Change “slider” to name of own image size.
    – There is a class to center image, give it maybe some gray background for smaller featured mages. fix margins and paddings, etc…

    function ntwb_bbpress_random_single_topic() {
            global $post;
    	    if ( has_post_thumbnail($post->ID) )
    	    	echo get_the_post_thumbnail($post->ID,'slider',array('class' => 'forum-topic-featured'));
        }
    // Hook into action
    add_action('bbp_template_before_lead_topic','ntwb_bbpress_random_single_topic');
    #185162
    kariellen35
    Participant

    By the way… what I did end up doing which has been a real good work-around, is use the bbp style pack single forum short code to show my forums as pages. This has been great, because it allows for much more modification! So I just added my featured image to each forum’s page.

    #185160
    kariellen35
    Participant

    Thank you so much for your help @stagger-lee! This code did work, however, it seems to only be for forum lists, which is an option already included in the bbp style pack plugin. I am trying to get the featured image to show up on the forum’s page itself (like what they do in buddypress groups) I don’t have forum lists accessible on my site so it’s not relevant to what I am doing. Thanks again for taking the time to post this tho!

    #185159
    andrew55
    Participant

    I don’t mean to ramble, but I think the solution will be something such as:

    if (Am_Lite::getInstance()->haveSubscriptions(364) && ($reply_user_id($topic_id) ))

    I just add bbpress statement to my already existing “if” statement using an “And” operator.

    I’m just getting caught up on the bbpress part.

    Any suggestions on what the bbpress code would be to “just show for the author of this reply?”

    Thanks for any help.

    #185158
    andrew55
    Participant

    I seems like this should work, but it doesn’t:

    <?php
    if (bbp_get_reply_author_id($reply_id))
    {
    ?>
    
    my other code goes here
    
    <?php
    }
    ?>

    It seems like it should wrap my code with a statement of “show only for the author of this reply” but it’s not working like this.

    Any suggestions on what the code would be to “just show for the author of this reply?”

    Thanks for any help.

    #185155
    andrew55
    Participant

    I’ve got a simple “php if snippet” I’m trying to get into loop-single-reply.php.

    Here is an example of my snippet (used for a seperate membership script):

    <?php
    require_once '/members/library/Am/Lite.php';
    $user = Am_Lite::getInstance()->getUser(); 
    ?>
    <?php
    if (Am_Lite::getInstance()->haveSubscriptions(364))
    {
    ?>
    <span class='custom-user-donation-badge'>I've Donated!</span>
    <?php
    }
    else {
    // do the other thing
    ?>
    <?php
    }
    ?>

    I need the code snippet to show only in the profile area of the reply author, if it applies to them.

    In other words: “show this if it applies and only show if it applies to this specific reply author.”

    I’ve used these before for something similar:

    $reply_user_id = bbp_get_reply_author_id();
    $reply_user = new WP_User( $reply_user_id )

    I’m still leaning php and bbpress. Any suggestions on how I can wrap my code snippet with these bbpress statements? This way, my code snippet will only apply if it applies to the specific author.

    Thanks for any suggestions.

    #185150
    PinkishHue
    Participant

    See this info –

    bbp_topic_author_link

    To display just the avatar linked to the member profile you would use:

    <?php bbp_topic_author_link( array( 'sep' => '<br />', 'show_role' => false, 'type' => 'avatar' ) ); ?>

    or for reply author’s:

    <?php bbp_reply_author_link( array( 'sep' => '<br />', 'show_role' => false, 'type' => 'avatar' ) ); ?>

    Hope that helps

    PinkishHue
    Participant

    1) Topic Type and Topic Status are only viewable to you/forum admins (aka keymasters), regular users do not see them

    2) Wherever you add custom CSS (probably ‘Appearance > Customize’ in the admin menu’s), add this:

    .bbp-forum-title {
      font-size: 18px; /* make this size whatever you prefer */
    }

    3) This functionality isn’t built in to bbpress but you could add another plugin to make this happen. Here is an old topic that might provide some suggestions for you: https://bbpress.org/forums/topic/rating-and-sorting-plugin/

    Hope that helps

    #185135
    Stagger Lee
    Participant

    Here is code for forum index, forum featured images, not topics:

    /*
    Plugin Name: bbPress - Forum Icons
    Plugin URI: https://gist.github.com/ntwb/8277457
    Description: bbPress - bbPress - Forum Icons
    Version: 0.1
    Author: Stephen Edgar - Netweb
    Author URI: http://netweb.com.au
    */
     
    // Original Source: http://www.kristarella.com/2013/04/bbpress-forum-icons/
     
    add_post_type_support('forum', array('thumbnail'));
     
    function ks_forum_icons() {
    	if ( 'forum' == get_post_type() ) {
    		global $post;
    	    if ( has_post_thumbnail($post->ID) )
    	    	echo get_the_post_thumbnail($post->ID,'thumbnail',array('class' => 'alignleft forum-icon'));
    	 }
    }
     
    add_action('bbp_theme_before_forum_title','ks_forum_icons');
    #185134
    Stagger Lee
    Participant

    In theme functions.php or custom field with functions.php.
    It gives featured image metaboxes in backend. Then you display featured image on front as any other post type featured. See how your theme is doing this and copy/paste whole code block.

    As you need only fetaured image allowed for admins and moderators you can use this:

    add_post_type_support('topic', array('thumbnail'));
    add_post_type_support('forum', array('thumbnail'));
    /*
    Plugin Name: bbPress - Forum Icons
    Plugin URI: https://gist.github.com/ntwb/8277457
    Description: bbPress - bbPress - Forum Icons
    Version: 0.1
    Author: Stephen Edgar - Netweb
    Author URI: http://netweb.com.au
    */
    // Original Source: http://www.kristarella.com/2013/04/bbpress-forum-icons/
    add_post_type_support('forum', array('thumbnail'));
    function ks_forum_icons() {
    	if ( 'topic' == get_post_type() ) {
    		global $post;
    	    if ( has_post_thumbnail($post->ID) )
    	    	echo get_the_post_thumbnail($post->ID,'thumbnail',array('class' => 'alignleft forum-icon'));
    	 }
    }
    add_action('bbp_theme_before_topic_title','ks_forum_icons');

    I will see later what is the best way to allow all Users to set topic featured images.
    But dont see much point in it. Thousands of forum topics, thousands of images on server x all WP image sizes. Big mess.

    #185130
    kariellen35
    Participant

    Stagger Lee, where did you add this code? Does it only bring up the image in forum or topic lists or does it appear on the forum page?

    #185128
    TKServer
    Participant

    This was missing from bbp-api.php:

    	register_rest_route( 'bbp-api/v1', '/users/(?P<id>\d+)', array(
    		'methods' => 'GET',
    		'callback' => 'bbp_api_users_one',
    	) );

    and users.php was also missing.

    I’m guessing that was intentional?

    #185123
    Chad R. Schulz
    Participant

    They are php templates inside bbPress. The default location in bbPress is /plugins/bbpress/templates/default/bbpress/ look for the ones labelled feedback-no-*****.php and alter/edit the ones you want changed and place them into your theme’s bbpress folder.

    Easy peasy.

    Chad

    #185111

    In reply to: Multisite

    Robin W
    Moderator

    sounds like a whole project, and way beyond a few lines of code.

    #185086
    PinkishHue
    Participant

    Thanks @robin-w, that works on the textarea. Still the topic title input and the fieldset above where it says ‘Create New Topic’ are overflowing out of the viewable area of the screen. Will post back with code if I figure out how to fix it.

    #185078
    Stagger Lee
    Participant

    My code (comment) is for backend, metaboxes. Or so I believe.

    #185071
    Stagger Lee
    Participant

    Seems to still work.

    add_post_type_support('topic', array('thumbnail'));

    add_post_type_support('forum', array('thumbnail'));

    <?php echo get_the_post_thumbnail($post_id, 'full'); ?>

    #185055

    In reply to: Change email sender

    Brandon Allen
    Participant

    @karilistermanyahoocom

    The default from email address for bbPress emails is noreply@(url).com. If you’re seeing wordpress@(url).com, it’s either not an email sent by bbPress, or you’re using a plugin that is changing the from address for all emails sent.

    To change the bbPress email, you would use the filter bbp_get_do_not_reply_address. For most (if not all) emails sent by your WordPress install, you’d use the wp_mail_from filter.

    #185043

    Do you know where I can modify the redirect page so that it only shows the 404 page not found message and not a list of my site’s pages

    It usually depends on the theme, but 404.php is a good start. It probably has some function or functions that put out a sitemap, but that’s just a guess, and every sitemap type plugin is different.

    In addition to bbPress, there are legitimate Membership plugins that are better equipped to handle things like private pages or members-only sections of websites. If you haven’t used any, Restrict Content Pro and Paid Memberships Pro are good ones.

    #185036

    Hi Kari,

    With both the weekend and a major community summit, the past few days have been pretty slow around here.

    This is a hard question to answer, because it depends on your forums and how you have them setup as private.

    There are also security implications to consider. For example, if your forums are only for logged in users, redirecting to a login page vs. showing a 404 hints to hackers that something exists vs. it not existing, which incentivizes the hunt.

    I usually try to recommend that forums use the login widgets, or otherwise have some always-available login form to use instead. That way private forums can still 404 for non-logged-in users, without the redirect hint.

    If you do want to redirect anyways, you’ll need a custom plugin to modify the way bbPress works.

    Unhook bbp_forum_enforce_private and bbp_forum_enforce_hidden, and write your own equivalent functions to use bbp_redirect() rather than bbp_set_404().

    #184998
    kariellen35
    Participant

    I can’t find a search box activation option or short code for a search box. I have activated my theme’s own search function and it doesn’t pick up on words from within the forums pages. Do you have a forum search option?

    Thank you for your time.

    Take care,
    Kari

    #184940
    vahid mohammadi
    Participant

    Hi
    you can use this code:

    add_action( 'bbp_new_reply',  'update_reply', 0, 6 );
    function update_reply( $reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = false, $author_id = 0, $is_edit = false ) {
    
    	$reply_id = bbp_get_reply_id( $reply_id );
    	$topic_id = bbp_get_topic_id( $topic_id );
    
    	if ( !bbp_is_topic_published( $topic_id ) || !bbp_is_reply_published( $reply_id ) ) return;
    
    	// $topic_email = bbp_get_topic_author_email($topic_id);
    	if (!empty($topic_id)) {
    		// if user is anonymous
    		if (bbp_is_topic_anonymous($topic_id)) {
    			$author_email = get_post_meta($topic_id, '_bbp_anonymous_email', true);
    			if ($author_email == 'nobody@example.com') return;
    
    			$topic_title   = strip_tags( bbp_get_topic_title( $topic_id ) );
    			$reply_content = strip_tags( bbp_get_reply_content( $reply_id ) );
    			$reply_url     = bbp_get_reply_url( $reply_id );
    			$blog_name     = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
    
    			$email_subject = $blog_name . ': ' . __( 'New reply to your topic', 'etuts' ) . '"' . $topic_title . '"';
    			$email_content = __( "New reply to your topic\nIn order to view the reply, open the bellow link\n", 'etuts' ) . $reply_url;
    
    			wp_mail( $author_email, $email_subject, $email_content );
    		}
    	}
    }
    
    InTempest
    Participant

    Reference site http://imapiece.com/

    Ill start by saying im not a developer and can edit php and code, but I cant write it from scratch…. yet

    So ive been moving a guild site over from phpbb into wordpress and am still trying to figure out the best way to handle applicants, I made a post here if anyone had any ideas about that
    https://bbpress.org/?post_type=topic&p=181981

    So I was looking into how to maybe do a multisite with a single forum handling all the main communication among the community as a whole. I was looking through the forum here and everything that said it cant be done is very old. Is there a way to have shortcodes and custom user fields to work around that? Or maybe iframe?

    Here is my thought, ill use car clubs for example

    Root Forum

    1 category – Car Club –
    1-2 forum – public
    1-3 forum – recruitment needs

    2 category – members only
    2-2 forum – New Car Club Applicant
    2-3 forum – Car Club Events
    2-4 forum – ADMIN

    3 categories – (3) Honda – (4) Ford – (5) Mazda
    3-2 forum – news rss
    3-3 forum – brand specific news

    Ok, so lets say on the main site if someone goes there it pulls everything since its the root. But give the car club its own multisite along with any niche sub group. In the custom user groups have shortcodes associated with the different ranks to show them on their member page when they look at the info something like [bbp-single-forum id=$forum_id] and add more to the root of that ranks permission. That way you dont have to add them per user, but per rank per group.

    so in the shortcode for public users they would only have access to 1 and its contents
    people in the honda club who are just members would have access to 1, 2(excluding 2-4) and 3, once they get bumped up to admin rank in that group the shortcode to display 2-4 gets added since its connected to rank roles.

    In the same breath on the front end of the multisite pages you could just have them display the public forums associated with that niche pulling the data from the forum via [bbp-single-forum id=$id ].

    I had a ton of control like this through phpbb using theme styling and domain masking and am trying to find a way to make it work in wordpress but its been a learning curve. I know groups in buddypress have some of this function built in, but it doesn’t seem to be tweak-able between sites. I dont want a guest to see every group in the opt in part of registration off the bat. Would rather have them app on that groups page, members review then they get added and what they see is based on what rank they have in all the groups they are in.

    So am i trying to overthink this? Have I missed something that could solve this idea?

    Thoughts/Suggestions?

    #184918

    In reply to: bbpress custom fields

    Robin W
    Moderator

    the actual hook is quite easy, there are numerous do-action calls within

    templates/default/bbpress/form-topic.php and form-reply.php

    The real issue is getting someone to code the fields, store them in the database, consider the ability for mods etc. to alter them or delete them, and then decide what you want to do with those fields – eg where to display them etc. etc.

Viewing 25 results - 5,126 through 5,150 (of 32,571 total)
Skip to toolbar