PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

retrieving file request from URL with $_GET

s2Member Plugin. A Membership plugin for WordPress®.

retrieving file request from URL with $_GET

Postby stonecoldcnc » December 26th, 2011, 11:29 pm

I'm trying to use the requested file name from the URL in another pluging. The code below works fine if I drop it into a new page BUT it does not work if I use it in another plugin. The variable $file_download_req is always = "!!! no filename !!!".


Code: Select all
<?php
$_g = stripslashes_deep ($_GET);

   if (isset ($_g["_s2member_seeking"]["file"])) {
   
   $file_download_req = esc_html ($_g["_s2member_seeking"]["file"]);
   
   } else {
   
   $file_download_req = '  !!!  no filename !!!  ';
   }
   echo 'file= ' . $file_download_req;
?>


The URL to retrieve the filename from looks like that (...?_s2member_seeking[type]=file&_s2member_seeking[file]=TestFile-CRRR540.dxf....)

All I need is to get the filename TestFile-CRRR540.dxf from the URL for further use in the other plugin.

Any help or hint would be greatly appreciated.
Juergen
Perth Western Australia


Information about CNC machines for Stone Stonecoldcnc.com
and free sink and basin DXF template files.
User avatar
stonecoldcnc
Registered User
Registered User
 
Posts: 19
Joined: September 1, 2010

Re: retrieving file request from URL with $_GET

Postby Cristián Lávaque » December 27th, 2011, 6:17 am

So you're trying to use the Membership Options Page variables in another WordPress installation? Are the variables in the URL for the page where you're trying to use them?

What is the URL of your s2Member installation and what is the URL of the page where you're trying to use this variable?

Thanks!
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: retrieving file request from URL with $_GET

Postby stonecoldcnc » December 27th, 2011, 7:54 am

Hi Cristián
perhaps I wasn't clear enough, I do not want to use the s2member variables in another Wordpress installation, I want to use them in a plugin which is installed in my Wordpress installation.

The URL to retrieve the filename from looks like that:
http://stonecoldcnc.com?s2member_file_download=Abey-CR540.dxf

As I said before, the code I've posted above your post is working fine if copied into a post/page but not in another php file which is a simple welcome email plugin. I just need to get the filename from the URL so I can send it with the welcome email.
Juergen
Perth Western Australia


Information about CNC machines for Stone Stonecoldcnc.com
and free sink and basin DXF template files.
User avatar
stonecoldcnc
Registered User
Registered User
 
Posts: 19
Joined: September 1, 2010

Re: retrieving file request from URL with $_GET

Postby Cristián Lávaque » December 28th, 2011, 5:58 am

How are you passing the URL to that PHP file? If you have it in a string, you could replace all the first part with nothing.

Code: Select all
$filename= str_replace('http://stonecoldcnc.com?s2member_file_download=', '', $url); 


I hope that helps.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: Majestic-12 [Bot] and 2 guests

cron