Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 5,251 through 5,275 (of 32,577 total)
  • Author
    Search Results
  • #183983
    virusek89
    Participant

    I also need something like that.
    Is there any plugin or code?

    Stephen Edgar
    Keymaster

    I was going to suggest renaming you’re plugins folder, you’ve done that already.

    Try renaming the directory of your theme, or the entire themes directory if that doesn’t work

    Strange, I tried hitting some URLs direct, e.g.

    • http://restomod101.com/test/wp-admin/edit.php?post_type=page
    • http://restomod101.com/test/wp-login.php

    I’d also suggest taking a look at any custom functions you have in a functions.php file

    What about rewrite rules, have you any custom rules in your .htaccess file?

    #183905
    dominikb
    Participant

    I realized, that i used another code mentioned in this forum, to change the original names of the roles, so i deleted this code and afterwards it just worked.

    #183904
    dominikb
    Participant

    I put the code into a custom plugin.

    #183898
    realnsleo
    Participant

    Hi Robin,
    I have just tried your code with BBPress 2.5.12 and I can not see the “trash” links. I hope it’s not a lot to ask, but could you know why it might be broken?

    From what I could test, it has something to do with the lines where the capabilities are given, for example this line:

    //allow any reply to be deleted
    if ($post_type == bbp_get_reply_post_type()) $caps = array('delete_replies');

    I appreciate any response.

    Regards,

    #183896
    xelota
    Participant

    Wordpress : WordPress 4.7.4 avec le thème BlackFyre.
    bbpress : Version 2.5.12
    http://www.vieuxetmechants.com/

    Hello i’ve created custom and i don’t understand the role MembreVetM can’t edit or delete their own post

    function add_new_roles( $bbp_roles )
    {
        $bbp_roles['bbp_gamer'] = array(
            'name' => 'Gamer',
             'capabilities' => custom_capabilities( 'bbp_gamer' )
            );
     
    	$bbp_roles['bbp_membrevetm'] = array(
            'name' => 'MembreVetM',
             'capabilities' => custom_capabilities( 'bbp_membrevetm' )
            );
    		
        $bbp_roles['bbp_veteran'] = array(
            'name' => 'Vétéran',
            'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() )
            );
    	
    	$bbp_roles['bbp_officier'] = array(
            'name' => 'Officier',
            'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() )
            );
    	
        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_gamer' )
            $caps = custom_capabilities( $role );
     
        if( $role == 'bbp_membrevetm' )
            $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 )
        {
     
            case 'bbp_gamer':
                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'   => false,
                    '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'   => false,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => false,
                    'delete_others_replies' => false,
                    'read_private_replies'  => false,
     
                    // Topic tag caps
                    'manage_topic_tags'     => false,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => false,
                    'assign_topic_tags'     => false,
                );
     
    			case 'bbp_membrevetm':
                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'         => true,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => true,
     
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => true,
                    'delete_others_replies' => false,
                    'read_private_replies'  => true,
     
                    // Topic tag caps
                    'manage_topic_tags'     => true,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => true,
                    'assign_topic_tags'     => true,
                );
     
                break;
     
            default :
                return $role;
        }
    }
    #183889
    negi15
    Participant

    where did you put that code?

    #183888
    blengine
    Participant

    Another solution for those interested. This makes use of the “Shortcodes in Menus” plugin to easily place the bbpress “View Profile” and “Edit Profile” links in your WordPress nav menus. Instructions:

    1 – Install the free plugin “Shortcodes in Menus”
    2 – Place the following code in your theme’s functions.php file:

    function menu_profile_link() { 
    		$current_user = wp_get_current_user();
    		$profile_menu_item = '<li><a href="' . home_url('forums/users/') . $current_user->user_nicename . '">View Profile</a></li>';
    		return $profile_menu_item;
    }
    add_shortcode('bbp-profile', 'menu_profile_link');
    
    function menu_edit_profile_link() { 
    		$current_user = wp_get_current_user();
    		$profile_menu_item = '<li><a href="' . home_url('forums/users/') . $current_user->user_nicename . '/edit">Edit Profile</a></li>';
    		return $profile_menu_item;
    }
    add_shortcode('bbp-edit-profile', 'menu_edit_profile_link');

    3 – In WordPress go to your Menus and go to the new Shortcodes panel. Type in “View Profile” as the title and underneath that type in [bbp-profile] to place the profile link in your menu. Click “Add to Menu”. Repeat this process using the shortcode [bbp-edit-profile] to add the “Edit Profile” link.

    4 – I’d also recommend the free plug-in “Nav Menu Roles” to restrict your menu items to logged in or logged out users.

    Hope this is useful!

    #183886
    Alex Stine
    Participant

    Hello,

    I’m using a plugin to integrate Amazon CloudSearch on my site. Whenever I exclude private topics from search results or private forums from search results, I might use some code like this.

    function exclude_private_topics_search() {
    	$topic_id = bbp_get_topic_id();
    	if(gdbbx_is_topic_private($topic_id) ) {
    		add_post_meta($topic_id, 'acs_exclude', 1, true );
    	} else {
    		delete_post_meta($topic_id, 'acs_exclude');
    	}
    }
    add_action('bbp_new_topic', 'exclude_private_topics_search' );
    add_action('bbp_edit_topic', 'exclude_private_topics_search' );
    
    function exclude_private_forums_search() {
    	$forum_id = bbp_get_forum_id();
    	if (get_post_status($forum_id) == 'private') {
    		add_post_meta($forum_id, 'acs_exclude', 1, true );
    	} else {
    		delete_post_meta($forum_id, 'acs_exclude');
    	}
    }
    add_action('bbp_new_forum', 'exclude_private_forums_search' );
    add_action('bbp_edit_forum', 'exclude_private_forums_search' );

    The problem is this does not update pagination counts. For example if 2 topics that are private are hidden and there are 5 topics in the forum, it will still display a total of 5 topics instead of 3 topics. How can I update the pagination values if there are less topics displaying AKA private ones?

    Thanks.

    #183885
    Alex Stine
    Participant

    Hello,

    I have a plugin that is used to index search results in to Amazon CloudSearch. I’ve written the below code to exclude private forums from search results. Now I need some code to automatically exclude all topics inside a private forum.

    function exclude_private_forums_search() {
    	$forum_id = bbp_get_forum_id();
    	if (get_post_status($forum_id) == 'private') {
    		add_post_meta($forum_id, 'acs_exclude', 1, true );
    	} else {
    		delete_post_meta($forum_id, 'acs_exclude');
    	}
    }
    add_action('bbp_new_forum', 'exclude_private_forums_search' );
    add_action('bbp_edit_forum', 'exclude_private_forums_search' );

    Is there anyway I can get a list of topic IDs inside a forum ID?

    Running latest version of bbPress and WordPress.

    Thanks.

    #183882

    In reply to: Only one forum showing

    dram2017
    Participant

    OK – I think I’ve solved it.
    In my theme (Vellum) the [bbp-forum-index] shortcode entered on the new forum page seems to be deleted every time I add a forum. Adding the shortcode again rebuilds the forum list and displays them in the specified order. Weird, but at least it is a workaround.

    #183877
    Robin W
    Moderator

    one will be from your theme and one from bbpress.

    if you have a link, I can give you code to hide the other

    #183871
    Dan
    Participant

    View post on imgur.com

    main theme has breadcrumbs that don’t match forum breadcrumbs. In a perfect world I’d like

    Home / Forum / Feedback / Marginally Clever Site Questions/Comments

    I think I can hide the breadcrumbs with

    div.bbp-breadcrumb { display: none; }

    but that won’t fix the upper breadcrumb.

    Please: what do you advise?

    #183863
    dominikb
    Participant

    ok, resolved.
    It was a conflict with another code, that renames the roles.

    malcolmpaulpearson
    Participant

    Hi all

    Shared Windows hosting.
    WordPress 4.6.5 running Karma theme.

    Hosting provider will not change the IIS config for just me, they recommend me adding a Linux shared hosting and host the bbpress on that server, external to the site.

    When I search with one word – it works fine. When I search with two words it gives the error:

    HTTP Error 404.11 – Not Found
    The request filtering module is configured to deny a request that contains a double escape sequence.

    Most likely causes:
    The request contained a double escape sequence and request filtering is configured on the Web server to deny double escape sequences.

    Things you can try:
    Verify the configuration/system.webServer/security/requestFiltering@allowDoubleEscaping setting in the applicationhost.config or web.confg file.

    Detailed Error Information:
    Module RequestFilteringModule
    Notification BeginRequest
    Handler ExtensionlessUrlHandler-Integrated-4.0
    Error Code 0x00000000
    Requested URL https://www.ciproza.co.za:443/forums/search/annual+returns/
    Physical Path D:\Websites\ciproza.co.za\httpdocs\forums\search\annual+returns\
    Logon Method Not yet determined
    Logon User Not yet determined

    More Information:
    This is a security feature. Do not change this feature unless the scope of the change is fully understood. You should take a network trace before changing this value to confirm that the request is not malicious. If double escape sequences are allowed by the server, modify the configuration/system.webServer/security/requestFiltering@allowDoubleEscaping setting. This could be caused by a malformed URL sent to the server by a malicious user.
    View more information »

    Anybody got a solution for me?

    #183828
    denrocs
    Participant

    Not tested this yet (I know this is nearly 3 years old – looking for something I’m currently working on) but I noticed that the code doesn’t have an opening PHP tag, just a closing one.
    I added the opening tag, installed as shown above, and not had this above error.

    Again, not tested but will confirm either way once I have set up a test post 🙂

    #183822
    Robin W
    Moderator

    ok, appreciate it is frustrating – I am currently fighting another IT corporate system that is annoying the hell out of me !

    It is a theme/bbpress issue, so we need to try stuff to work out what works

    so can you set up a page called community forum and have it’s permalink end in ‘communityforum’ and into the content of that page put

    [bbp-topic-index]

    #183817

    In reply to: Catchable Error

    codyrauh
    Participant

    so from what I have read it is something to do with the “echo” and that forums to have categories.

    }
    endif;
    function simplenotes_get_breadcrumbs(){
    	global $wp_query; 
    	if ( !is_home() ){
    		echo '<ul>';
    		echo '<li><a href="'. home_url() .'">'. get_bloginfo('name') .'</a></li>';
    		if ( is_category() ) 
    		{
    			$catTitle = single_cat_title( "", false );
    			$cat = get_cat_ID( $catTitle );
    			echo "<li> &nbsp; ► ". get_category_parents( $cat, TRUE, " ► " ) ."</li>";
    		}
    		elseif ( is_archive() && !is_category() ) 
    		{
    			echo "<li> &nbsp; ► Archives</li>";
    		}
    		elseif ( is_single() ) 
    		{
    			$category = get_the_category();
    			$category_id = get_cat_ID( $category[0]->cat_name );
    			echo '<li> &nbsp; ► '. get_category_parents( $category_id, TRUE, "</li><li> &nbsp; ► " );
    			echo the_title('','', FALSE) ."</li>";
    		}
    		elseif ( is_page() ) 
    		{
    			$post = $wp_query->get_queried_object(); 
    			if ( $post->post_parent == 0 ){ 
    				echo "<li>&nbsp; ► ".the_title('','', FALSE)."</li>";
    			} else {
    				$title = the_title('','', FALSE);
    DragoWeb
    Participant

    Hi, the apostrophe (simple quote) was displayed as &#039 ; in the email subject so I fixed this by adding this line:

    $topic_title = mb_convert_encoding($topic_title, 'UTF-8', 'HTML-ENTITIES');

    in myrsite\wp-content\plugins\bbpress\includes\common\functions.php, lines 1094 and 1252 (bbpress 2.5.12). Between these 2 lines:

    $topic_title   = strip_tags( bbp_get_topic_title( $topic_id ) );
    $topic_title   = mb_convert_encoding($topic_title, 'UTF-8', 'HTML-ENTITIES');
    $topic_content = strip_tags( bbp_get_topic_content( $topic_id ) );

    I’m a beginner with php so maybe there is a better way to achieve this, but worked great for me 🙂

    #183794
    panda666uk
    Participant

    Any idea on this error ? Thanks

    WordPress database error: [Unknown column 'users.id' in 'field list']
    SELECT convert(users.id USING "utf8mb4") AS id,convert(users.password USING "utf8mb4") AS password,convert(users.username USING "utf8mb4") AS username,convert(users.email USING "utf8mb4") AS email,convert(kunena_users.websiteurl USING "utf8mb4") AS websiteurl,convert(users.registerDate USING "utf8mb4") AS registerDate,convert(users.name USING "utf8mb4") AS name,convert(kunena_users.aim USING "utf8mb4") AS aim,convert(kunena_users.yim USING "utf8mb4") AS yim,convert(kunena_users.gtalk USING "utf8mb4") AS gtalk,convert(kunena_users.icq USING "utf8mb4") AS icq,convert(kunena_users.msn USING "utf8mb4") AS msn,convert(kunena_users.skype USING "utf8mb4") AS skype,convert(kunena_users.twitter USING "utf8mb4") AS twitter,convert(kunena_users.facebook USING "utf8mb4") AS facebook,convert(kunena_users.myspace USING "utf8mb4") AS myspace,convert(kunena_users.linkedin USING "utf8mb4") AS linkedin,convert(kunena_users.delicious USING "utf8mb4") AS delicious,convert(kunena_users.friendfeed USING "utf8mb4") AS friendfeed,convert(kunena_users.digg USING "utf8mb4") AS digg,convert(kunena_users.blogspot USING "utf8mb4") AS blogspot,convert(kunena_users.flickr USING "utf8mb4") AS flickr,convert(kunena_users.bebo USING "utf8mb4") AS bebo,convert(kunena_users.websitename USING "utf8mb4") AS websitename,convert(kunena_users.location USING "utf8mb4") AS location,convert(kunena_users.signature USING "utf8mb4") AS signature FROM jos_users AS users LEFT JOIN jos_kunena_users AS kunena_users ON kunena_users.userid = users.id LIMIT 0, 100
    abkrim
    Participant

    Hi.

    According Enable visual editor I put on my child theme’s functions.php code

    `// Additional Functions
    // =============================================================================

    // bbPress Visual Editor
    function bbp_enable_visual_editor( $args = array() ) {
    $args[‘tinymce’] = true;
    $args[‘teeny’] = false;
    return $args;
    }
    add_filter( ‘bbp_after_get_the_content_parse_args’, ‘bbp_enable_visual_editor’ );`

    But not work.

    Also I try to install plugin TinyMCE Advanced but not work.

    I’m using X Theme (Theme.co)

    #183772
    Robin W
    Moderator

    that text is in

    \templates\default\bbpress\form-topic.php

    and you’ll probably also want

    \templates\default\bbpress\form-reply.php

    for replies

    you’ll probably want to put revised versions in your child theme

    Functions files and child themes – explained !

    You can copy all the templates across, but you only need to copy those that you want to change, and it is better just to do this, as then you know which you have altered.

    so if you wanted to amend form-topic.php you would do the following

    create a directory on your theme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

    where %your-theme-name% is the name of your theme

    find
    wp-content/plugins/bbpress/templates/default/bbpress/form-topic.php
    Make a copy of this file, and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/form-topic.php
    bbPress will now use this template instead of the original
    and you can amend this

    Scott N
    Participant

    @talkedtv — I know it’s been three years, but if you can remember and describe here how your theme caused this problem and how you fixed it, I’d be most appreciative! My forum search is exhibiting the exact same behavior, and I am using a highly customized theme, including custom bbPress templates.

    EDIT: I did come up with a workaround, but it’s clunky as it requires creating a blank placeholder page with the slug search. In my page.php template, right after the_post() is called, I added this:

    if ( strpos($_SERVER['REQUEST_URI'], '/search/') === 0 ) {
        $post = get_page_by_path('search');
    }
    #183742

    In reply to: TTFB problem

    newz12
    Participant

    I have hired someone to look at the database and this is his comments:

    ==========================================

    so, basically your query is processing too many records in a couple of tables wp_posts(1’980’935 records) and wp_postmeta(10’818’678). It matches and returns 57’639 records.

    The core query is:
    select SQL_NO_CACHE wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1 AND (wp_posts.ID = 515125 OR wp_posts.post_parent = 515125);

    which returns 399’291 record for 2.1s
    which is a huge join

    Then the extra “where” conditions add extra time. The query bellow:

    select SQL_NO_CACHE wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1 AND (wp_posts.ID = 515125 OR wp_posts.post_parent = 515125) AND wp_postmeta.meta_key = ‘_bbp_forum_id’;

    reduces the returned records to: 57’639 and in fact the rest of the where statements do not change the final result but are only adding more time for processing.
    The query takes about 3s.

    Both queries above are well indexed and are execucuted in the optimal way.
    With this amount of returned records matched against the 2 big tables (~11mln and ~2mln records in each) executon time of less than 3s can not be achieved.

    is this forum using a custom php code developed in house?

    ME: It is using bbPress, which runs on WordPress

    the thing is, this code is not optimal in term of database design
    because it’s using a couple of wordpress general storage tables
    to store the forum posts and threads
    as you can guess this 2 tables have a lot more data in it along the forum data
    from other hand the query you sent has too many “where” conditions
    which are not relevant at all

    AND CAST(wp_postmeta.meta_value AS SIGNED) NOT IN (‘515120′,’515123’) ) )
    AND wp_posts.post_type IN (‘topic’, ‘reply’)
    AND (
    (wp_posts.post_status = ‘publish’ OR (wp_posts.post_status = ‘pending’ AND wp_posts.post_author = 0) OR wp_posts.post_status = ‘closed’ OR wp_posts.post_status = ‘hidden’)
    OR
    (wp_posts.post_author = 0 AND (wp_posts.post_status = ‘private’))
    )

    non of this are changing the final result at all, but are slowing the core query with extra time

    in short – there is not an easy “magic” fix in the database side
    as I said the core query is well indexed and runs optimal by the SQL engine
    the only thing can be done is to change the query a bit
    but we can hardly get it under 2.5s
    and this will require PHP code changes

    ME: What would be your suggestion to achieve a similar performance with database?

    get rid of the WP
    the WP pluggin you use is a forum implementation on top of WP
    understand that, but you are expecting something by this WP pluggin that it can’t provide

    with storring everyhing in a couple of tables – that can’t be done

    won’t even comment:
    AND CAST(wp_postmeta.meta_value AS SIGNED) NOT IN (‘515120′,’515123’) ) )

    this part
    wp_postmeta | CREATE TABLE wp_postmeta (
    meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    post_id bigint(20) unsigned NOT NULL DEFAULT ‘0’,
    meta_key varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
    meta_value longtext COLLATE utf8mb4_unicode_ci,
    PRIMARY KEY (meta_id
    )

    as you can see meta_value field is a longtext!!!
    you can imagine how can you filter by this field
    without index
    scanning millions of records by a field that holds huge strings
    in same table wp stores all sessions, etc..

    just to imagine how much extra data is stored in wp_postmeta table
    here is a some stats by meta_key and the number of records (top 20 or so):

    | external_image_id | 100828 |
    | external_place_lat | 100845 |
    | external_place_lng | 100862 |
    | external_upload_batch | 110848 |
    | amazonS3_cache | 121546 |
    | _bbp_activity_id | 199233 |
    | filter | 239951 |
    | id_field | 239952 |
    | __defaults_set | 239974 |
    | _bbp_post_id | 1418227 |
    | _bbp_topic_id | 1426899 |
    | _bbp_author_ip | 1426899 |
    | _bbp_forum_id | 1426909 |
    | _barcelona_vote_up | 1732202 |
    | _barcelona_views | 1732206 |

    in fact this WP pluggin is using mysql as a simple storage and not as a relational DB
    as I said above it’s a bad DB design problem
    because it’s a just a pluggin/extension of a CMS system

    ==========================================================

    Basically he is telling me that we won’t be able to achieve good loading time, because it is running on WordPress and the database design is a problem.

    What do you think, is there hope?

    We run a forum with 1.4 million posts and almost 100k members, if it can give you an idea.

    #183741
    ico33
    Participant

    Hi, in my site I noticed a strange issue after last WordPress update. It seems to have problem with “cache”.

    For example, if I log-in through the Home Page, after click in sign-in, the page refresh but it seems that the log-in didn’t work. If I press F5 to refresh the page, here I can now see the log-in effectuated.

    I thought about my caching plugin, and I wrote to the assistance of my provider. They exclude the problem is in caching plugin, they found this:

    The issue appears to be caused from the latest WordPress upgrade that was automatically applied within your website.

    Code:

    sitename@esm9 [~/public_html]# wp core version
    4.7.4

    There seems to be conflict between a plugin of yours that is creating this strange behavior within the website.

    To find which is the responsible plugin, you may start deactivating them one by one and after that checking the functions that were not working as expected. Once they work this will indicate which plugin caused the issue.

    I did what they suggest, and when I deactivate BBPRESS, everything works! So, what to do??

Viewing 25 results - 5,251 through 5,275 (of 32,577 total)
Skip to toolbar