Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 12,201 through 12,225 (of 32,521 total)
  • Author
    Search Results
  • #144780
    Robin W
    Moderator

    ok, you have several routes to go

    If you think you will be making other changes, then it may be worth you reading this

    Step by step guide to setting up a bbPress forum – part 2

    but if you just want to get this going then download this plugin

    https://wordpress.org/plugins/simple-custom-css/

    and then put this code into it

    #bbpress-forums .bbp-topic-content p,
    #bbpress-forums .bbp-reply-content p {
    color: blue !important ;
    }

    a:link {
    color: blue !important ;
    }

    Obviously you can change the blue to whatever, or use hex codes to get any shade you like

    http://www.w3schools.com/cssref/css_colors.asp

    Come back if that doesn’t work, and I’ll try to help further

    #144779
    Robin W
    Moderator

    some of the code in here might help you

    Layout and functionality – Examples you can use

    bbpressuserkb
    Participant

    Hello,

    I added the follwoing code to functions.php

    add_action( ‘init’, ‘blockusers_init’ );
    function blockusers_init() {
    if ( is_admin() && ! current_user_can( ‘administrator’ ) &&
    ! ( defined( ‘DOING_AJAX’ ) && DOING_AJAX ) ) {
    wp_redirect( bbp_user_profile_link( bbp_get_current_user_id() ) );
    exit;
    }
    }

    This redirects users to http://www.mydomainame.org/wp-admin/profile.php
    and displays a link to their BBPress Profile.
    Question is, how do I redirect users directly to to their BBPress profile?

    This is probably something very simple, but I am not a developer unfortunately.

    Thanks for your help.

    #144771
    Grimsilver
    Participant

    I would not be entirely sure where to put the code lol.

    #144768
    Robin W
    Moderator

    ok if it proves an issue, you could use

    if ( is_singular( array('forum', 'topic', 'reply') ) ) {
        //  conditional content/code
    }
    #144766
    Robin W
    Moderator

    yes they are on your site.

    If I gave you the code and said for you to add this to your style.css would you know what I was asking?

    If so I’ll cut some for you to use

    If not, come back and I’ll try and help further

    #144764
    SooperGenius
    Participant

    Nevermind, Robin. It’s just a Notice and not an error at this point. I’m not going to stress over it at the moment. The code is working fine. Thanks for the help.

    #144760
    Grimsilver
    Participant

    So I know people will facepalm at the question, but I am just really confused on this and I don’t wanna edit and mess the little bit of work I have done up lol. So anywho, how can I change the font color on the topics and posts? They are pretty difficult to see: http://i.imgur.com/8ZOOaef.png But yeah, I really dunno much (If anything) about code or website stuff so, surprised I got this far! Thanks for the help!

    #144758
    SooperGenius
    Participant

    is_bbpress() almost works. Thanks for the pointer there, by the way. I can’t see how I missed that function in all my searching. I failed my Google-fu obviously. My code now looks like this in the my-plugin.php file.

    function forum_lock_check($allcaps, $cap) {
    	if (function_exists("is_bbpress")) {
    		$is_bbpress = is_bbpress();
    	} else {
    		$is_bbpress = false;
    	}
    	
    	return $allcaps;
    }
    
    add_filter("user_has_cap", "forum_lock_check", 10, 3); 

    Here’s the funny part. (Funny = weird not Funny = haha) If I’m navigating to the main forums page (http://localhost/wordpress/forums/), then everything proceeds swimmingly. If I then navigate to a forum within the page (http://localhost/wordpress/forums/forum.forum-a) or to a thread within the forum (http://localhost/wordpress/forums/topic/post-1) I then get several of the following errors.

    Notice: Trying to get property of non-object in C:\xampp\htdocs\wordpress\wp-includes\query.php on line 3792
    
    Notice: Undefined property: WP_Query::$post in C:\xampp\htdocs\wordpress\wp-includes\query.php on line 3306

    Commenting out the “$is_ppbress = is_bbpress();” line removes the errors but I’ve got no idea why WordPress suddenly doesn’t like the code. Have you seen this before? What file is is_bbpress() in?

    Thanks, Robin.

    #144757

    In reply to: PM button in posts

    shpitzyl
    Participant

    Hey Stephen, I’ve modified your code. With your code, when clicking on the link, it redirects the user to the compose form with the “Send To” field empty. I wanted to fill this field for the user automatically, just the way it works in buddypress user page. So I came up with this code.

    function ntwb_bbp_bp_pm() {
        if(function_exists('bp_send_private_message_link') && is_user_logged_in() ) {
    
            $user = get_userdata( bbp_get_reply_author_id()  ); 
    
            if ( !empty( $user->user_nicename ) ) {
                $user_nicename = $user->user_nicename;
            }
            $compose = bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . $user_nicename;
            
            ?>
            <a>" title="Private Message">Private Message</a>
            <?php
        }
    }
    add_action( 'bbp_theme_after_reply_author_details', 'ntwb_bbp_bp_pm' );

    I’m not a php programmer and I’m not sure that I did it the right way, but hey, it works.

    #144756

    In reply to: bbPress Login Widget

    Robin W
    Moderator

    you can edit the profile page to prevent them changing it

    In your theme create a bbpress folder

    wp-content/themes/%yourtheme%/bbpress

    where %yourtheme% is the name of your theme

    then navigate to

    wp-content/plugins/bbpress/templates/default/bbpress/form-user-edit.php

    and copy this file to the bbpress folder you created above

    bbpress will now use this one instead of the default.

    edit this new file and take out lines 33 to 45

    ie take out the following

    <div>
    			<label for="nickname"><?php _e( 'Nickname', 'bbpress' ); ?></label>
    			<input type="text" name="nickname" id="nickname" value="<?php bbp_displayed_user_field( 'nickname', 'edit' ); ?>" class="regular-text" tabindex="<?php bbp_tab_index(); ?>" />
    		</div>
    		<div>
    			<label for="display_name"><?php _e( 'Display Name', 'bbpress' ) ?></label>
    			<?php bbp_edit_user_display_name(); ?>
    		</div>
    		<?php do_action( 'bbp_user_edit_after_name' ); ?>
    

    This will remove the ability to set a nickname and to change the display name.

    #144753
    Robin W
    Moderator

    is_bbpress()

    should do it I think.

    Otherwise bbpress has custom post types of forum, topic and reply.

    You should also consider disabling or modifying the bbpress search function, as otherwise searches will go forum wide, giving a backdoor.

    Good luck !

    #144752
    SooperGenius
    Participant

    Hi,

    Here’s my situation. I have a site with several forums. Let’s call them Forum A, B and C. All users to the site can view Forum A. Through other actions that happen on the site users collect points. At a certain point total Forum B becomes available. At another point total Forum C becomes available. There is an external webservice I can call to see if the user has the appropriate number of points for the relevant Forum.

    As far as I can tell, bbPress doesn’t have the built in capability to handle that particular permissions scenario so I’m building a plugin. My plugin is hooking on the “user_has_cap” filter to determine whether a user can see a particular forum. I don’t want to make an external webservice call on every single current_user_can() call that gets made during a page load, so in my hook function I want to immediately check to see if the current request is a Forum page.

    For example, if the requested page was “http://localhost/wordpress/forums/forum/forum-b/&#8221; then being able to get the pagename “forums” it would allow me to jump out of my hook function immediately if the request wasn’t for a forum page or topic. Below is a copy of code/pseudocode for what I’m doing in the plugin.

    function forum_lock_check($allcaps, $cap) {
        if (pagename != "forums") return $allcaps;	
    
        if (webservice says I can) {
            $allcaps["can-view-forum"] = true;
        }
        return $allcaps;
    }
    
    add_filter("user_has_cap", "forum_lock_check", 10, 3); 

    Is there a wordpress or bbpress function that gives me the pagename the forum is attached to? Of course, if there is an easier way to do what I want, I’m all ears for that as well. Thanks for any help you can give me.

    #144741
    palmdoc
    Participant

    Hi @peterwsterling
    I’m keen to get your plugin but I am also using WP Polls for blog posts and pages and in fact WP Polls can also embed in bbpress posts (https://wordpress.org/plugins/wp-polls/installation/) though Polls can only be created by Admins from the backend

    WP Polls also uses the short code poll but in a different format
    [poll id="2" type="result"]

    But I like the concept of users being able to create their own polls in forum posts so I’d be keen to get your plugin provided it doesn’t conflict with WP Polls. Hope you can confirm.

    Thanks

    #144730
    Robin W
    Moderator

    You should really be looking to get rid of the toolbar for everyone but moderators and above ! It shouldn’t really be seen by users.

    go to dashboard>users and for each user untick the toolbar

    The codex has help on putting logins and profile on the menu pages – see

    https://codex.bbpress.org/layout-and-functionality-examples-you-can-use/ no.s 8 & 11/12

    #144729

    In reply to: No toolbar available

    gobeyond
    Participant

    Hello Liberty and all the experts here,

    I am having the same problem. I set up the bbpress using a minimalist theme I created from scratch. Everything works except the missing toolbar in the editor.

    I added the following code in the functions.php file, but I only saw two tabs “Visual” and “Text”, but no toolbar, as shown in the picture posted above by “Liberty.”

    function bbp_enable_visual_editor( $args = array() ) {
        $args['tinymce'] = true;
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );

    When I switched to the Twenty Ten theme, the toolbar showed up nicely. I know my theme is missing something, but can’t seem to be able to figure out what I am missing. Any help will be greatly appreciated!!!

    Have a great day!

    Terry

    Robin W
    Moderator

    I’ve submitted a trac ticket to improve the code !

    Robin W
    Moderator

    glad to have someone else looking !

    My ajax is hopeless !

    Your solution is valid, but digging for it produced some code issue

    we have several issues here

    firstly the filter call is wrong in the code ie

    bbpress/includes/topics/template.php has two errors

    function bbp_get_topic_subscription_link( $args = array() ) {
    ......Parse the arguments......
    		), 'get_forum_subscribe_link' );

    so the function is ‘get_topic_subscription’ but the parse argument reverts to ‘get_forum_subscribe

    whilst it doesn’t affect this issue the error is repeated for favorites in the same file

    function bbp_get_topic_favorite_link( $args = array() ) {
    ..........), 'get_forum_favorite_link' );
    

    needs changing to ‘get_topic_favorite_link’`

    This doesn’t affect the issue as such, other than the filters above are wrong.

    But filtering bbp_get_topic_subscription_link is totally pointless, as it immediately calls
    ‘get_user_subscribe_link’ which them resets the |, so whilst the filter seems to correct it once, any click just resets it.

    So your filter to get_user_subscribe_link is the correct one, but for the wrong reason.

    Really the code needs to have the filter in one place only (suspect user)

    Anyway the solution for @majid436 is as you suggest

    function hide_before3 ($args = array() ) {
    $args['before'] = '';
    return $args;
    }
    add_filter ('bbp_before_get_user_subscribe_link_parse_args','hide_before3');
    
    #144713
    Equisbono
    Participant

    Hello,

    I have looked everywhere and could not find an answer.

    I found other things like putting the link in a menu item.

    But, what I wanna do is redirect the user profile page. I do not want to use bbPress´.

    So, to be specific. I am using UPME, a premium wordpress theme from Codecanyon.

    And the profile link for this plugin (User Profiles Made Easy) is:

    http://codeboy.co/profile/username

    So I want to get rid of the bbPress user profile that appears in the forums and when a user creates a debate/post it will automatically link there, link:

    http://codeboy.co/forums/users/Codeboy/

    I want it to link here instead:

    http://codeboy.co/profile/username

    So from plain view it looks like I would just need to change this link in some php file of bbPress, yet I have not had any luck after many hours of headaches.

    Could somebody please help me?

    Thanks!

    #144712

    In reply to: Tags

    batmanfan
    Participant

    I tried here… bbpress/includes/common/shortcodes.php

    though I entered ‘smallest’ => 11, and ‘largest’ => 20,

    the font size only show 11 on all – same size. Did I do something wrong? I thought it would randomly display 11 to 20?

    tharsheblows
    Participant

    I think this is going to be less than helpful for you, I’m sorry.

    I’m not sure but it doesn’t look like / I can’t find where bbp_notify_forum_subscribers (the function that sends emails to subscribers) is hooked into the admin topic post save. What I mean is, you’re right, the subscriptions don’t seem to sent if you create a new topic in admin. (I could be completely wrong about this and just missed something though.)

    Anyway, I’m just going to write down where I would start if that is the case because I hope that I can come back to this in a bit or someone else will and otherwise I’ll forget (I’m off on holiday tomorrow). I would say to hook it into save_post but I’m not sure that you can do that because bbp_notify_forum_subscribers doesn’t check post type so would run on any post type save.

    So something like this: https://codex.wordpress.org/Plugin_API/Action_Reference/save_post#Custom_Post_Type:_.27book.27 I mean the write a function that checks for post type bit and call bbp_notify_forum_subscribers.

    And do the same thing with the reply post type, too (but with bbp_notify_subscribers).

    If this gets moved to trac, it would be easier to change those two functions to check for post type first thing and hook them both directly into save_post rather than the way above.

    Again, I might just be missing where it’s hooked in. I hope that I’m missing something obvious and it’s an easy fix! 🙂

    tharsheblows
    Participant

    I think it’s the ajax call that’s doing it. So you would need to filter the bbp_get_user_subscribe_likelink like this – this also includes the bits to change your subscribe and unsubscribe links:

    function hide_before2 ($args = array() ) {
    $args['before'] = '&nbsp';
    $args['subscribe'] = 'Click to receive an email notification when a member responds below';  
    $args['unsubscribe'] = 'Unsubscribe'; // or whatever
     
     return $args;
    } 
    
    add_filter('bbp_before_get_user_subscribe_link_parse_args', 'hide_before2');
    #144683
    Stephen Edgar
    Keymaster

    Thanks, I created ticket #2580 and we’ll take a look.

    As I stated in that ticket they are stored as a serialized array in wp_options.wp_user_roles

    #144680
    Stephen Edgar
    Keymaster

    I am writing something to add a one-click unsubscribe link for the subscription emails, so need them to be unique for each recipient in that respect.

    Ok, I follow you now, cool idea 🙂 If you ‘hack’ core it will break when you upgrade bbPress. 🙁

    I presume you want the individual email so each link is unique and the user does not have to be logged in to unsubscribe?

    So maybe create a ticket on Trac with a patch to have bbp_notify_subscribers fire after the redirect.

    #144678
    Stephen Edgar
    Keymaster

    I suppose that would work, though with the updates of the above code in bbPress 2.6 the performance cost of creating a separate email for each individually subscribed user has been removed and the impact of this before or after the redirect would be minimal.

    Your original post:

    I am working on a one-click unsubscribe link that will need to use the old way of sending the emails individually.

    Essentially by doing this you will reintroduce the bottle neck that we just removed :/

    Why do you need to create the emails individually?

    Creating a single email with the recipients BCC’d gets the email to every subscriber from the ‘list of topic subscribers’ with only a single email and is far more efficient than creating an individual email for every subscriber.

Viewing 25 results - 12,201 through 12,225 (of 32,521 total)
Skip to toolbar