• Hello,
    is it possible to use in WFUP a variable coming from another plugin ?
    As an example, I have a variable $company and I would like to use it in the upload dropbox path.
    I tried to use it in a hook ‘wfu_after_upload_handler’ :
    $dropboxpath = “mmm/”.$company.”/”.$username.”/”.$additional_data[“files”][0][“user_data”][1][“value”].”/”.$today;
    I tried to set $company as a global variable but couldn’t get it work.
    Thanks for ideas and help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author nickboss

    (@nickboss)

    Unfortunately dropbox upload path cannot be changed from a hook. However you can do a trick. Here is how:

    1. Add a new text user field in the form (suppose it is the 3rd one). Hide it so that the user does not see it.
    2. Set dropboxpath to be “mmm/%userdata3%”
    3. Add a “Before Execution of Uploaded File Check” hook.
    4. In this hook you can change the value of the 3rd user data field like this:

    $changable_data["user_data"][2]["value"] = $company."/".$username."/".$changable_data["user_data"][1]["value"]."/".$today;
    or whatever you like.

    5. Then dropbox upload path will be updated accordingly.

    Nickolas

    Thread Starter jlohl

    (@jlohl)

    Thanks a lot Nickolas,
    I’ll try and let you know.

    Thread Starter jlohl

    (@jlohl)

    Hi

    the trick is fine if in ‘wfu_before_file_check_handler’, I write something like :
    $changable_data[“user_data”][2][“value”] = $changable_data[“user_data”][1][“value”];
    or
    $changable_data[“user_data”][2][“value”] = “newcompany”;

    but it fails if I use :
    $changable_data[“user_data”][2][“value”] = $company;
    or $changable_data[“user_data”][2][“value”] = $GLOBALS[“company”];
    I suppose it fails because I cannot get $company to be seen by WFUP as a global variable ?
    I’ll keep testing, cheers.
    JL

    Plugin Author nickboss

    (@nickboss)

    well $GLOBALS[“company”] should work, the question is when it takes its value?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘variable outside of WFU’ is closed to new replies.