Easy Blogging Customization

I would like to add extra links within the easy blogging plugin (such as to wordpress stats and support etc). Is this possible? If so any suggestions?

Thanks!

  • wlpdrpat
    • Site Builder, Child of Zeus

    I was able to add additional links in the easy admin.

    You have to edit 3 files located in /wp-content/plugins/easyblogging/easybloggingfiles/

    admin_area.php
    at line 42 in this file you will see how the links are created. Copy and existing one and edit to meet your requirements. There are a couple items in creating the new link that need to be matched in the following for it to work.

    easy_blogging.php
    at line 56 you will need to add to allowedpages array. What you add to this array will need to be matched in the new link you added to the admin_area.php

    frame.php
    Look at the case for theme in this file and create a new case for your new link. Again this info will match what you need to add in the admin_area.php.

    You also have to ensure that the permissions are correct in admin_area.php for who you want to access the new link and just because they can see the link if they don't have WP permissions they won't be able to access it. Just match the new links that you create to the user level that can access the link in Advanced Admin and you will be golden.

    Pat

  • wlpdrpat
    • Site Builder, Child of Zeus

    Would be great if adding new tabs to Easy Blogging Admin didn't require editing the code.

    Also the ability to add items to the list for display: none.

    I just upgraded my Easy blogging plugin as it broke when I upgraded to 3.0.4 and had to re-edit the files to add in my custom tabs and custom display: none.

    If you added a admin page for this pluggin where you could customize the tabs, their visibility by roles, and the display: none items it would definitely make managing this plugin much more user friendly.

    This of course would help the guys that have no idea what I was talking about when I described how to add a new tab in the previous message.

    Thanks,
    Pat

  • mmedia
    • The Incredible Code Injector

    Hey guys.. thanks alot of the tips earlier they helped alot!

    We are trying to add the following links:

    Status ( /wp-admin/index.php?page=stats)
    Support ( wp-admin/admin.php?page=incsub_support_tickets)

    Here is what has been added to the array:

    var $allowedpages = array( 'index-php', 'post-php', 'post-new-php', 'edit-php', 'page-new-php', 'edit-pages-php', 'edit-comments-php', 'themes-php', 'widgets-php', 'profile-php',
    'premium-themes-php', 'media-upload-php', 'comment-php', 'admin-ajax-php', 'async-upload-php', 'page-php', 'supporter-help-php', 'supporter-php', 'support-ticket-php', 'wp-stats-php'
    );

    Here is what has been added to frame.php

    break;
    case 'wp-stats':
    $page= 'wp-stats';
    $frame_url = admin_url('index.php?page=stats');
    break;
    case 'support-ticket':
    $page= 'support-ticket';
    $frame_url = admin_url ('admin.php?page=incsub_support_tickets');
    break;

    The links appear on the page but I suspect that the plugin won't allow the user to go directly to admin.php or index.php ?

  • mmedia
    • The Incredible Code Injector

    Also here is what I added to the admin_area.php


    <?php }
    if (current_user_can('edit_pages')) { ?>

  • /wp-admin/?frame=support-ticket" class="tab_tooltip" title="<?php _e( 'Support Tickets|View and Enter Tickets', $this->localizationDomain ) ?>"><span><?php _e( 'Support Tickets', $this->localizationDomain ) ?></span>
  • <?php }
    if (current_user_can('edit_pages')) { ?>

  • /wp-admin/?frame=wp-stats" class="tab_tooltip" title="<?php _e( 'Wordpress Stats|View Site Statistics and Traffic', $this->localizationDomain ) ?>"><span><?php _e( 'Wordpress Stats', $this->localizationDomain ) ?></span>
  • wlpdrpat
    • Site Builder, Child of Zeus

    I would have used the following format:

    case 'premium-themes':
    $page = 'themes';
    $frame_url = admin_url('themes.php') . '?page=premium-themes';
    break;

    case must match the link id in admin-area.php without -php.
    $page must match the allowed page in easy-blogging.php and I also matched it with the actual php file being called as in the case above themes.php = themes

    If user has the right permissions it should then be accessible.

    So, in you specific situation I would create the following in frame.php

    break;
    case 'index-stats':
    $page= 'index';
    $frame_url = admin_url('index.php') . '?page=stats';
    break;
    case 'admin-support-ticket':
    $page= 'admin';
    $frame_url = admin_url ('admin.php') . '?page=incsub_support_tickets';
    break;

    I would add index-stats-php, admin-support-ticket-php, and admin-php to easy-blogging.php

    Then I would use the following in admin-area.php:
    <a id="index-stats-php" href=" (the rest of the code here) /wp-admin/?frame=index-stats (the rest of the code here)
    <a id="admin-support-ticket-php" href=" (the rest of the code here) /wp-admin/?frame=admin-support-ticket (the rest of the code here)

    That should do it for you.
    Pat

  • mmedia
    • The Incredible Code Injector

    Thanks Pat,
    The ticket link is working now but the stats link just opens up another instance of easyblogging below the top menu with the new post page showing.

    case 'index-stats':
    $page= 'index';
    $frame_url = admin_url('index.php') . '?page=stats';
    break;

    <?php }
    if (current_user_can('edit_pages')) { ?>

  • /wp-admin/?frame=index-stats" class="tab_tooltip" title="<?php _e( 'Wordpress Stats|View Site Statistics and Traffic', $this->localizationDomain ) ?>"><span><?php _e( 'Wordpress Stats', $this->localizationDomain ) ?></span>
  • var $allowedpages = array( 'index-php', 'post-php', 'post-new-php', 'edit-php', 'page-new-php', 'edit-pages-php', 'edit-comments-php', 'themes-php', 'widgets-php', 'profile-php',
    'premium-themes-php', 'media-upload-php', 'comment-php', 'admin-ajax-php', 'async-upload-php', 'page-php', 'supporter-help-php', 'supporter-php', 'index-stats-php', 'admin-support-ticket-php' , 'admin-php' , 'support-ticket-php', 'wp-stats-php'
    );

  • wlpdrpat
    • Site Builder, Child of Zeus

    This is a permissions issue with your plugin.

    In your plugin file (I am not sure what plugin you are working with but this would be the case with most plugins) there is a function that is used for creating the plugin page and another function for creating the link in your admin menu for the plugin page.

    This is a generic example of what to look for:

    function stats_on_admin_menu()
    {
    add_plugin_page(__('Stats'), __('Stats'), 'manage_options', 'stats', 'stats_option_page');
    }

    I just quickly wrote the above as this is a typical format for creating the link in the admin menu but please excuse if it isn't perfect.

    What you are looking for is the capability that is assigned to have access. In the above example it is manage_options. In this case only users with manage_options capability would be able to see the link or access the page - and the same would apply in the Easy Admin area. When the easy admin creates a duplicate easy admin area when you try to access a tab it is saying you don't have permission.

    You can change this in your plugin to be edit_posts (if you want users that can edit posts to see this link and access this page).

    I had the same issue with the options page for my theme. It was set to manage_options and therefore only Administrators could see it. I changed the permissions and voila.

    Hope that helps.

    Pat

  • mmedia
    • The Incredible Code Injector

    Hey Pat, thanks alot for your help!

    Just have a couple more quick things I was wondering about...

    Might this be caused by the easyblogging plugin being in the regular plugins directory and not the mu-plugins directory.

    And when you say plugin file.. are you referring to the easyblogging plugin, or the stats plugin?

    Thanks

  • wlpdrpat
    • Site Builder, Child of Zeus

    Hey Mmedia,

    I have easyblogging installed in the regular plugins directory and have it activated network wide, which is essentially the same as being in the mu-plugins folder in regards to the permissions.

    The plugin file that I was referring to in my previous post was the stats plugin.

    Pat

  • mmedia
    • The Incredible Code Injector

    Hey Pat,

    I believe I found that part of the stats plugin code that needs to be changed to "edit posts".


    function stats_admin_menu() {
    global $current_user;
    $roles = stats_get_option('roles');
    $cap = 'administrator';
    foreach ( $roles as $role ) {
    if ( current_user_can($role) ) {
    $cap = $role;
    break;
    }
    }
    if ( stats_get_option('blog_id') ) {
    $hook = add_submenu_page('index.php', __('Site Stats', 'stats'), __('Site Stats', 'stats'), $role, 'stats', 'stats_reports_page');
    add_action("load-$hook", 'stats_reports_load');
    }
    $parent = stats_admin_parent();
    $hook = add_submenu_page($parent, __('WordPress.com Stats Plugin', 'stats'), __('WordPress.com Stats', 'stats'), 'manage_options', 'wpstats', 'stats_admin_page');
    add_action("load-$hook", 'stats_admin_load');
    add_action("admin_head-$hook", 'stats_admin_head');
    add_action('admin_notices', 'stats_admin_notices');
    }

    It's a bit more complicated than your example, but do you think I'm on the right track?

    $hook = add_submenu_page($parent, __('WordPress.com Stats Plugin', 'stats'), __('WordPress.com Stats', 'stats'), 'manage_options', 'wpstats', 'stats_admin_page');

  • wlpdrpat
    • Site Builder, Child of Zeus

    Actually, Yours is much easier. Line 5 is where you define the role that can access the site stats. It is currently set to 'Administrator'. Here you would enter the capability you would want the user to have to be able to see the stats page. For example, edit_posts would allow any user that has the capability to edit_posts would be able to see the page.

    Line 20 is defining who can see all of the sites stats and to setup the configuration of the plugin - I would make this manage_network so that only Super Admin can access details to all sites.

    Pat

  • mmedia
    • The Incredible Code Injector

    Oh great :slight_smile:

    I will make that change when I get back home today and let you know if it worked.

    One thing to note is that I can see the stats page fine if I go into advanced admin mode, but with the same user I get the issue with the duplicate easy admins. Is it possible that easy admin won't open this page because the role is set to administrator? The user I'm using is admin.

  • wlpdrpat
    • Site Builder, Child of Zeus

    Hey Mmedia,

    What is the url for this page when you are in Advanced?

    Is it the Admin page for configuring the plugin or is it the view stats page?

    Of course I am assuming that the Admin Config Page is a separate page from the view stats page. Please correct me if I am wrong.

    Thanks,
    Pat

  • mmedia
    • The Incredible Code Injector

    Hey Pat,

    The Stats Plugin we are using is the wordpress.com one. In advanced it is:

    /wp-admin/index.php?page=stats

    This actually gave me the idea to try using /wp-admin/admin.php?page=stats ..

    In advanced that will also bring me to the stats page and it will show the graph and all data the same as index.php would.

    I switched it in my code and it allowed me to access the page in easy admin!

    Here is a screen shot of it:
    http://i.imgur.com/umf6w.jpg

    The only issue now is that for some reason the flash stats app box isn't displaying any data. It should look like this:
    http://i.imgur.com/frxFU.jpg

    Really appreciate the dialog Pat!

  • wlpdrpat
    • Site Builder, Child of Zeus

    Looks like an iframe issue. What you are seeing in the Easy Admin area is an iframe of the advanced admin area. There may be some settings that need tweaked to get it to display properly.

    What is the url of your stats module? I will install it and see if I can get it to work properly in the Easy Admin and let you know what I did.

    Pat

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.