Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 6,626 through 6,650 (of 32,505 total)
  • Author
    Search Results
  • TKServer
    Participant

    Nice plugin you created. Do you think it would be possible to create shortcodes in the next update? My theme is so old it does not have widget areas LOL.

    Thanks, cool plugin BTW.

    That’s an interesting suggestion. It would not be hard but for the settings. Since the widget settings are set inside the widget itself, I’d have to redo the settings and make them part of the plugin settings.

    I’ll see what I can do…

    tech55541
    Participant

    Hey @tkserver,
    Nice plugin you created. Do you think it would be possible to create shortcodes in the next update? My theme is so old it does not have widget areas LOL.

    Thanks, cool plugin BTW.

    tech55541
    Participant

    Hello,
    It is more than likely custom coded.

    Thanks.

    #173498
    olliewe88
    Participant

    hi again @robin-w

    Ok so I have put the code below in the functions.php

    function add_new_roles( $bbp_roles )
    {
    /* role the new role*/
    $bbp_roles[‘bbp_Facepainter’] = array(
    ‘name’ => ‘Facepainter’,
    ‘capabilities’ => custom_capabilities( ‘bbp_Facepainter’ )
    );

    return $bbp_roles;
    }

    add_filter( ‘bbp_get_dynamic_roles’, ‘add_new_roles’, 1 );

    function add_role_caps_filter( $caps, $role )
    {
    /* Only filter for roles we are interested in! */
    if( $role == ‘bbp_Facepainter’ )
    $caps = custom_capabilities( $role );

    return $caps;
    }

    add_filter( ‘bbp_get_caps_for_role’, ‘add_role_caps_filter’, 10, 2 );

    function custom_capabilities( $role )
    {
    switch ( $role )
    {

    /* Capabilities for ‘Facepainter’ role */
    case ‘bbp_Facepainter’:
    return array(
    // Primary caps
    ‘spectate’ => true,
    ‘participate’ => true,
    ‘moderate’ => false,
    ‘throttle’ => false,
    ‘view_trash’ => false,

    // Forum caps
    ‘publish_forums’ => false,
    ‘edit_forums’ => false,
    ‘edit_others_forums’ => false,
    ‘delete_forums’ => false,
    ‘delete_others_forums’ => false,
    ‘read_private_forums’ => true,
    ‘read_hidden_forums’ => false,

    // Topic caps
    ‘publish_topics’ => true,
    ‘edit_topics’ => true,
    ‘edit_others_topics’ => false,
    ‘delete_topics’ => false,
    ‘delete_others_topics’ => false,
    ‘read_private_topics’ => true,

    // Reply caps
    ‘publish_replies’ => true,
    ‘edit_replies’ => true,
    ‘edit_others_replies’ => false,
    ‘delete_replies’ => false,
    ‘delete_others_replies’ => false,
    ‘read_private_replies’ => true,

    // Topic tag caps
    ‘manage_topic_tags’ => false,
    ‘edit_topic_tags’ => false,
    ‘delete_topic_tags’ => false,
    ‘assign_topic_tags’ => true,
    );

    break;

    default :
    return $role;
    }
    }}

    However, it is still not working. It shows when I go to Users,user,Forum Role and set it to facepainter but when I save it, it still doesn’t set their fourm role to face painter?!

    Thanks for you help

    #173495
    Robin W
    Moderator

    the code is additional and goes in your functions.php

    see

    Functions files and child themes – explained !

    #173492
    tech55541
    Participant

    Hello,
    That code worked great. Could you please help me make another view for solved topics?

    I almost did it myself, but I do not know what or how to find the meta_value that I need.

    Thanks for your help.

    #173489
    tech55541
    Participant

    @robkk, I am quite a new coder, I will have to test it later and figure out what is wrong.

    Thanks.

    #173487
    olliewe88
    Participant

    Custom Capabilities

    Thank you however for the link above where do you find the code to edit @robin-w

    #173484
    Robin W
    Moderator
    #173481
    Robkk
    Moderator

    You can create a custom view, use this shortcode in a page [bbp-single-view id='unresolved'], then just link to it in a menu or use the views widget bbPress provides.

    function rkk_register_unresolved_view() {
     	bbp_register_view( 'unresolved', __( 'Unresolved Topics' ), array( 'meta_key' => 'bbr_topic_resolution', 'meta_value' => '2', 'orderby' => 'post_date', 'post_status' => 'publish' ), false );
     }
     add_action( 'bbp_register_views', 'rkk_register_unresolved_view' );
    #173480
    Pascal Casier
    Moderator
    #173479
    Robkk
    Moderator

    @bj87

    Do what @casiepa said and just put the bbPress template content-single-forum.php in a folder called bbpress in your child theme, and edit the file.

    A guide like this would help you figure out how you can customize the bbPress default theme in a child theme.

    https://codex.bbpress.org/themes/theme-compatibility/

    Just make your file look similar to this gist.

    https://gist.github.com/robkk/059c1f87b3d21cf75dd9


    @tech55541
    thanks for helping out in a few topics in the support forums, but your code shows undefined messages in the user profile subscriptions section if you are subscribed to a forum.

    #173478
    Pascal Casier
    Moderator
    $current_user = wp_get_current_user();
    $user_id = $current_user->ID;
    if ( 0 == $user_id ) {
        // Not logged in.
    } else {
        // code from previous thread, use function like bbp_get_user_topic_count_raw($user_id)
    }

    Not tested ! But should be in that direction…

    #173470
    tech55541
    Participant

    Hello,
    Couldn’t you still use functions.php with this code to restrict it to BBPress.

    if ( is_bbPress() ):

    Makes since to me.

    Thanks.

    #173469
    tech55541
    Participant

    Hello,
    Please insert this code in a mu-plugin. Using FTP, create a folder named “mu-plugins” in the /wp-content directory without the quotes. Then create a file named what ever you want with a .php extention. For example, example-plugin.php.

    <?php
    add_action( 'wp_footer', 'reposition_selector' );
    function reposition_selector() {
    ?>
    <script type="text/javascript">
    jQuery( document ).ready(function() {
    var htmlString = jQuery('.bbp-topic-form').html();
    jQuery('.bbp-topic-form').css('display','none');
    jQuery( "<div class='bbp-topic-form'>"+htmlString+"</div>" ).insertBefore( "#subscription-toggle" );
    		});
    	</script>
        <?php
    }

    Thanks.

    #173467
    bj87
    Participant

    Help the last time, where should i paste that code you wrote in?

    #173466
    bj87
    Participant

    So where should i place that code again?

    It looks like this in my footer.php at the end, already another script also…

    // Echo the scripts added to the "before </body>" field in Theme Options
    		echo Avada()->settings->get( 'space_body' );
    		?>
    
    		<!--[if lte IE 8]>
    			<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/assets/js/respond.js"></script>
    		<![endif]-->
    	</body>
    </html>
    #173465
    tech55541
    Participant

    Hello,
    I would just edit the template, I could not make my code work either.

    Thanks.

    #173456
    chaya579
    Participant

    i’m used with Content Aware Sidebars to create dynamic sidebars but its not work for bbpress form.
    how can i add specific to bbpress forms?

    tried to add code to bbpress.php and to sidebar.php but still can not add sidebars on bbpress.

    thanks

    #173455
    tech55541
    Participant

    Hello,
    You could try something like this. Place this code before the ending </html> tag in your footer.php file of your theme.

    <script>
    jQuery($('.bbp-topic-form').insertAfter('#subscription-toggle');
    </script>
    #173452
    Pascal Casier
    Moderator

    Hi Johan, goede avond,

    I suppose you can copy the content-single-forum.php to your own child theme and modify it accordingly.
    https://codex.bbpress.org/themes/theme-compatibility/step-by-step-guide-to-creating-a-custom-bbpress-theme/

    Pascal.

    #173448
    Robkk
    Moderator

    @elovkoff

    You do not have to create a child theme just for custom code snippets, you can also use a custom plugin, this plugin below will give you an area to add custom php code snippets.

    https://wordpress.org/plugins/functionality/

    I still rather suggest you just stick with an inline image upload plugin instead of gd bbPress attachments(unless you are using pro), instead of removing the error notice and allowing empty replies.

    #173439
    dalemiles
    Participant

    Hi Pascal,

    Thanks, updating the wordpress profile is not a problem I can do that.

    However using the code from bbPress profile such as:

    <?php do_action( 'bbp_template_before_user_profile' ); ?>
    
    	<div id="bbp-user-profile" class="bbp-user-profile">
        <h1>View Users Trading Profile Here <?php get_the_author_id(); ?></h1>
       
    		<h2 class="entry-title"><?php _e( 'Profile', 'bbpress' ); ?></h2>
    		<div class="bbp-user-section">
    
    			<?php if ( bbp_get_displayed_user_field( 'description' ) ) : ?>
    
    				<p class="bbp-user-description"><?php bbp_displayed_user_field( 'description' ); ?></p>
    
    			<?php endif; ?>
    
    			<p class="bbp-user-forum-role"><?php  printf( __( 'Role: %s',      'bbpress' ), bbp_get_user_display_role()    ); ?></p>
    			<p class="bbp-user-topic-count"><?php printf( __( 'Topics Started: %s',  'bbpress' ), bbp_get_user_topic_count_raw() ); ?></p>
    			<p class="bbp-user-reply-count"><?php printf( __( 'Replies Created: %s', 'bbpress' ), bbp_get_user_reply_count_raw() ); ?></p>
    		</div>
    	</div><!-- #bbp-author-topics-started -->
    
    	<?php do_action( 'bbp_template_after_user_profile' ); ?>

    added to my author.php doesn’t work.

    I presume its because its not tied to the bbPress ‘user’ profile?

    #173437
    dalemiles
    Participant

    You sir are a legend, that worked perfectly.

    Would it be hard to put the user details onto my author page?
    (topics created, replies created then a list of each).

    I can create tabs at the bottom like on my current author pages and put the code to show the information in there.

    #173435
    Pascal Casier
    Moderator

    Something like this in your functions.php ?

    add_filter( 'bbp_pre_get_user_profile_url', 'casiepa_custom_author_link' );
    function casiepa_custom_author_link( $user_id ) {
    	return get_author_posts_url( $user_id, '' );
    }
Viewing 25 results - 6,626 through 6,650 (of 32,505 total)
Skip to toolbar