Forum Replies Created

Viewing 12 replies - 1 through 12 (of 12 total)
  • Forum: Fixing WordPress
    In reply to: Remove browse tab

    I just tested this out on my localhost, so I don’t know if there will be problems down the line…

    Open: upload.php

    Find:

    if ( $pid ) {
    	// 0 => tab display name, 1 => required cap, 2 => function that produces tab content, 3 => total number objects OR array(total, objects per page), 4 => add_query_args
    	$wp_upload_tabs['upload'] = array(__('Upload'), 'upload_files', 'wp_upload_tab_upload', 0);
    	if ( $all_atts && $post_atts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = '$post_id'") )
    		$wp_upload_tabs['browse'] = array(__('Browse'), 'upload_files', "wp_upload_tab_browse", $action ? 0 : $post_atts);
    	if ( $post_atts < $all_atts )
    	$wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse', $action ? 0 : $all_atts);
    } else
    	$wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse', $action ? 0 : $all_atts);

    Change To:

    if ( $pid ) {
    	// 0 => tab display name, 1 => required cap, 2 => function that produces tab content, 3 => total number objects OR array(total, objects per page), 4 => add_query_args
    	$wp_upload_tabs['upload'] = array(__('Upload'), 'upload_files', 'wp_upload_tab_upload', 0);
    	if ( $all_atts && $post_atts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = '$post_id'") )
    		$wp_upload_tabs['browse'] = array(__('Browse'), 'upload_files', "wp_upload_tab_browse", $action ? 0 : $post_atts);
    	if ( current_user_can('import')
    		if ( $post_atts < $all_atts )
    			$wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse', $action ? 0 : $all_atts);
    } else
    	$wp_upload_tabs['browse-all'] = array(__('Browse All'), 'upload_files', 'wp_upload_tab_browse', $action ? 0 : $all_atts);

    I added if ( current_user_can(‘import’) ) to make it an Administrator only thing.

    Ref: Capability vs. Role Table

    You may have to change your Text Size Options in IE to Medium.

    Forum: Fixing WordPress
    In reply to: Completely lost.

    You can make your own images and change the .css sheets.

    It’s not an easy thing to do especially if you don’t know what you are doing (like myself) but it can be done.

    I just tested out the “Only admin users are allowed to upload anything” and it failed considering that an Author was able to upload a .zip file on my test server.

    This seems to be a very basic security flaw that could take down hosting servers very easily.

    I used this Roles and Capabilities for reference.

    ——–

    To remove Comments in moderation (1) for all users except Administrator:

    Open: wp-admin/index.php

    Find: `<?php if ( $numcomments ) : ?>
    <p><?php echo sprintf(__(‘Comments in moderation (%s) »’), number_format_i18n($numcomments) ); ?></p>
    <?php endif; ?>`

    Change To: `<?php if ( current_user_can(‘import’) ) { ?> <?php if ( $numcomments ) : ?>
    <p><?php echo sprintf(__(‘Comments in moderation (%s)’), number_format_i18n($numcomments) ); ?></p>
    <?php endif; ?><?php } ?>`

    Save & Close

    I added: <?php if ( current_user_can(‘import’) ) { ?> at the beginning and <?php } ?> at the end.

    ——–

    To show only Dashboard | Write | Profile for everybody except Administrator:

    Open: wp-admin/menu.php

    Find: `if (strpos($_SERVER[‘REQUEST_URI’], ‘edit-pages.php’) !== false)
    $menu[5] = array(__(‘Write’), ‘edit_pages’, ‘page-new.php’);
    else
    $menu[5] = array(__(‘Write’), ‘edit_posts’, ‘post-new.php’);
    if (strpos($_SERVER[‘REQUEST_URI’], ‘page-new.php’) !== false)
    $menu[10] = array(__(‘Manage’), ‘edit_pages’, ‘edit-pages.php’);
    else
    $menu[10] = array(__(‘Manage’), ‘edit_posts’, ‘edit.php’);

    $menu[15] = array(__(‘Comments’), ‘edit_posts’, ‘edit-comments.php’);`

    Change To: `if (strpos($_SERVER[‘REQUEST_URI’], ‘edit-pages.php’) !== false)
    $menu[5] = array(__(‘Write’), ‘edit_pages’, ‘page-new.php’);
    else
    $menu[5] = array(__(‘Write’), ‘edit_posts’, ‘post-new.php’);
    if ( current_user_can(‘import’) )
    if (strpos($_SERVER[‘REQUEST_URI’], ‘page-new.php’) !== false)
    $menu[10] = array(__(‘Manage’), ‘edit_pages’, ‘edit-pages.php’);
    else
    $menu[10] = array(__(‘Manage’), ‘edit_posts’, ‘edit.php’);
    if ( current_user_can(‘import’) )
    $menu[15] = array(__(‘Comments’), ‘edit_posts’, ‘edit-comments.php’);`

    Save & Close

    I added: if ( current_user_can(‘import’) ) before and after the Manage commands.

    ——–

    You can change ‘import’ to something lower if you want someone lower than an Administator to be able to view.

    Microdot, I think I figured everything out.

    I’m using version 2.3.1 and I am not at my normal computer at the moment – where my test server is at.

    I will post the changes that I made later when I do get to my computer.

    Looks like we are on our own.

    I made a separate topic earlier because I didn’t see this one. I guess if falls under the same lines of what you want, so I will post it here to improve the odds of getting an answer.

    —–

    I want to remove some links that are seen based on the user’s role.

    Right now a Subscriber is only able to see the following links in the dashboard: Dashboard | Profile which is fine since they don’t need to see anything else.

    The Contributor is able to see Dashboard | Write | Manage | Comments | Profile and I want them only to see Dashboard | Write | Profile.

    How would I be able to change this?

    Thread Starter longhair

    (@longhair)

    Thanks for the reply 🙂

    I have the WP files in a different directory (as decribed HERE).

    So when I click on the new My Profile link, it goes to http://localhost/profile.php and not http://localhost/wp/profile.php.

    Thread Starter longhair

    (@longhair)

    I just figured it out.

    There was another sidebar h2 farther down the page.

    Thanks again

    Thread Starter longhair

    (@longhair)

    Actually it is there, I just forgot to type it out in my reply.

    Thread Starter longhair

    (@longhair)

    After I added:

    #sidebar h2 { color: #0000FF }

    Everything changed color (Pages, Archives, Categories, and Meta) except for “Blogroll”.

    This is what I see when I do View Source afterwards:

    <li id="linkcat-2" class=linkcat"><h2>Blogroll</h2>

Viewing 12 replies - 1 through 12 (of 12 total)