About this topic

  • Posted by StiveG 1 year ago. There are 4 posts. The latest reply is from byron.
  • This topic is not resolved

No tags yet.

  1. By default, if you don't allow visitors to upload, the tickbox upload links don't show up at all. What if you want your visitors to know they can upload IF they register?

    If found a way to do this using a different form popup if the user is not logged in.

    Here is what I did.

    First, I created a new form : "not_logged_in"

    In "HTML for Custom form" I put :

    <div style="text-align:center;font-weight:bold;font-size:13px;">
    
    <div style="color:#FF0000;padding:15px 5px 25px 5px;">You must be login to upload pictures.</div>
    
    <div><a href="http://www.YOURSITEHERE.com/login/">LogIn</a>   
    <a href="http://www.YOURSITEHERE.com/login/?action=register&instance=1">SignUp</a>
    </div>
    
    </div>

    Then, I added this in bwb-photosmash.php

    1- In the getAddPhotosLink function, I changed the height and width for the new popup like this :

    if( $use_tb	)
    	{
    		if ($formname == "not_logged_in") {
    
    		$this->psOptions['tb_height'] = 100;
    		$this->psOptions['tb_width'] = 250;
    		} else {
    		$this->psOptions['tb_height'] = (int)$this->psOptions['tb_height'] ? (int)$this->psOptions['tb_height'] : 390;
    		$this->psOptions['tb_width'] = (int)$this->psOptions['tb_width'] ? (int)$this->psOptions['tb_width'] : 545;
    		}

    2- In the buildGallery function, I added a ELSE statement for the visitors (not logged in) :

    if( ( $formName || !$this->psOptions['use_manualform'] ) && !$skipForm ){
    		if( $g['contrib_role'] == -1 || current_user_can('level_'.$g['contrib_role']) ||
    			current_user_can('upload_to_photosmash') || current_user_can('photosmash_'
    			.$g["gallery_id"])){		
    
    			//Takes into account whether we're using Thickbox or not
    			$ret .= $this->getAddPhotosLink($g, $blogname, $formName);
    
    			//Get the Upload Form
    			if($this->psOptions['uploadform_visible'] || $g['form_visible'] ){
    				if(is_page() || is_single()){
    					$ret .= $this->getPhotoForm($g,$formName);
    				}
    			}else{
    				$ret .= $this->getPhotoForm($g, $formName);
    			}
    		}
    		else {
    		$formName = "not_logged_in";
    		$ret .= $this->getAddPhotosLink($g, $blogname, $formName);
    		$ret .= $this->getPhotoForm($g, $formName);
    		}
    	} //closes out the use_manualform condition

    Now, the visitors (not logged in) get the same link (Add Photos)
    but instead of the upload form popup, they get a popup telling them to log in or register if they want to upload.

    AS ALWAYS, USE AT YOUR OWN RISK. I'm really not an expert!

    EDIT : Well actually this is not only for visitors but for everyone who doesn't have the right to upload.

    Since I allow everyone to upload (except visitors) it's ok for me.

    You might wanna use !is_user_logged_in in the last function instead.

  2. Hi Steve,

    That's a clever workaround. Thanks for posting!

    There is some built-in functionality around this, however.

    Go to PhotoSmash > Advanced...scroll down to "Msg - No Authorization for Uploading"

    It's a small field, but you can put in any HTML you want...use [login] to get a login link.

    Another trick is that you have to have a form name in your shortcode...if you're using the standard form, you can just say: [photosmash form=std (plus whatever else you need)]

    Cheers,
    Byron

  3. "There is some built-in functionality around this, however."

    Are you kidding me? Ahhhh man! lol

  4. Well...you know ;-)

RSS feed for this topic