• Resolved flintsonline

    (@flintsonline)


    Hi
    Having trouble integrating File Away with S2Member when using Manager Mode. Everything works brilliantly out of manager mode. My challenge comes when using manager mode. I hope you can help!

    The shortcodes I’m using are as follows:

    [fileup base=”s2member-files” matchdrawer=”true”]

    [fileaway type=”table” base=”s2member-files” paginate=”true” pagesize=”10″ searchlabel=”Search” filenamelabel=”Document Name” datelabel=”Modified” customdata=”Category” manager=”true” directories=”true” s2skipconfirm=”true”]

    When I remove manager=”true” the file link url is set to the proper s2member link and access to the uploaded files is correctly restricted to users with the correct privileges. When I set manager mode to true – the file link url reverts to the normal real url path and s2member is rejecting access and diverting me to the s2membership page.

    I’m logged in as an administrator with full s2member access rights, I’ve set File Away manager access to the appropriate users and groups, I’ve tried setting the base directory to both the s2member directory and none.

    I’m lost on what to try next.

    Thanks

    https://www.ads-software.com/plugins/file-away/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author thomstark

    (@thomstark)

    Plugin Author thomstark

    (@thomstark)

    You mean rejecting access for downloads? Yeah, good.

    Manager mode needs the filename to be in its original state in the url, because it’s doing move/rename/delete/copy operations. Same reason encryption is disabled in manager mode. You can put two tables on the page, one, with manager mode, with showto=”administrator” on the page, and one without manager mode for everyone.

    Or, you could build yourself a neat little plugin or function in your theme’s functions.php, something like this:

    class my_fileaway_extension
    {
    	public function __construct()
    	{
    		add_shortcode('fileaway_switch', array($this, 'router'));
    	}
    	public function router($atts)
    	{
    		if(isset($_REQUEST['fa_mm']) && $_GET['fa_mm'] == 1)
    		{
    			$mm = 1;
    			$atts['manager'] = 'true';
    		}
    		else
    		{
    			$mm = 0;
    			if(isset($atts['manager'])) unset($atts['manager']);
    		}
    		$fileaway = new fileaway;
    		$files = $fileaway->sc($atts);
    		if(current_user_can('administrator'))
    		{
    			$files .= '<div id="fileaway-mm-switch-container" style="width:200px; margin-top:30px; margin-right:15px; display:inline-block;">';
    			$files .= '<select id="fileaway-mm-switch" style="width:100%;">';
    			$files .= '<option value="1" '.selected($mm, 1, false).'>Manager Mode</option>';
    			$files .= '<option value="0" '.selected($mm, 0, false).'>Regular Mode</option>';
    			$files .= '</select>';
    			$files .= '</div>';
    			$files .= "<script>";
    			$files .= "jQuery(document).ready(function($){ ";
    			$files .= "$('body').on('change', 'select#fileaway-mm-switch', function(){ ";
    			$files .= "var mm = $(this).val(); ";
    			$url = fileaway_utility::querystring(get_permalink(), $_SERVER["QUERY_STRING"], array("fa_mm" => "%m"));
    			$files .= "var url = '".$url."'; ";
    			$files .= "url = url.replace('%m', mm); ";
    			$files .= "window.location.href = url; ";
    			$files .= "}); ";
    			$files .= "}); ";
    			$files .= "</script>";
    		}
    		return $files;
    	}
    }
    new my_fileaway_extension;

    Then just use [fileaway_switch] in place of your [fileaway] shortcode, with all the attributes you would normally use, minus manager=”true”.

    Plugin Author thomstark

    (@thomstark)

    I deleted my first post, because I forgot to add the administrator check on switch dropdown. Added in second post.

    Thread Starter flintsonline

    (@flintsonline)

    Thanks for the fast response Thom!
    The function will be very useful however this is not solving this issue… my problem is that S2Member rejects the download when in manager mode (and only when in manager mode). So I have the following shortcodes on my page:
    THIS ONE DOWNLOADS THE FILE OK –
    [fileup base=”s2member-files” matchdrawer=”true”]
    [fileaway type=”table” base=”s2member-files” paginate=”true” pagesize=”10″ searchlabel=”Search” filenamelabel=”Document Name” datelabel=”Modified” customdata=”Category” directories=”true” s2skipconfirm=”true”]

    BUT THIS ONE REJECTS THE DOWNLOAD TELLING ME I DON’T HAVE PERMISSIONS!
    [fileup base=”s2member-files” matchdrawer=”manager”]
    [fileaway type=”table” base=”s2member-files” paginate=”true” pagesize=”10″ searchlabel=”Search” filenamelabel=”Document Name” drawerid=”manager” datelabel=”Modified” customdata=”Category” manager=”true” directories=”true” s2skipconfirm=”true” showto=”administrator”]

    The administrator (and other users) can download successfully from the 1st shortcode but cannot download from the 2nd. The only difference is MANAGER=”TRUE” is added to the 2nd.

    Does that make sense?

    Thanks

    Plugin Author thomstark

    (@thomstark)

    Yes, I understand. That is exactly what I just told you. That’s why I gave you a function to switch between manager mode and non-manager mode so you can download the files in non-manager mode without using two tables.

    Thread Starter flintsonline

    (@flintsonline)

    I’m really sorry if I’m being slow to pick up what you are saying!
    Are you saying that it should NOT be possible for an administrator to download a file using the plugin while in manager mode? To download a file the administrator would need to switch to regular mode.

    Plugin Author thomstark

    (@thomstark)

    That’s correct. s2members is the special case where you cannot download files when in manager mode.

    As a make-shift solution, I provided a function that will allow you to toggle your shortcode between manager mode and regular mode. Hope that’s clear and that it helps.

    Best,
    t

    Thread Starter flintsonline

    (@flintsonline)

    Yes – thank you and sorry for being slow on the uptake!
    Thanks for your super fast support – much appreciated!

    Plugin Author thomstark

    (@thomstark)

    Not a problem. Have fun.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Manager Mode and S2Member’ is closed to new replies.