Jump to content

quickjeff

Members
  • Posts

    323
  • Joined

  • Last visited

Posts posted by quickjeff

  1. Kongondo, yea sorry about that guys.  I got a little post happy! I would find a post related to what I needed help with and would post my questions.  Next time I will post in the correct areas as well as not double post. 

    I will study further the API and see what I come up with. Ultimately I would like to recreate the delete button and functionality of the button but only for the front editor.   Im sure I can figure it out.  

    Thanks for the guidance!

  2. In their profile page where they can edit their password. I allow users to post new pages and currently have them edit their own pages posted via fredi front end editor module. Any light on giving a user the ability to unpublish, publish or delete their posted page? Perhaps a check mark with a submit or simply a button that allows this. Basically how an admin would publish, unpublish or delete pages now only difference, its only the page a user is assigned to edit through the front end. Any help is appreciated.

  3. Hi Guys,

    Im at a point in my project where I have front end user registration, login capabilities and posting of page capabilities by registered users. The users can also edit their own page. Its pretty much a clean site that is made to function like Craigs list but look like a personal ad site. I have used ryans method for registration, profile control and login. All is good so far! Now in profile template which I call their account management page, a user sees all their pages they have posted. The user can click the link to their page to front end edit their pages content. I would like to also give them ability to unpublish, republish or delete their page. Any thoughts or ideas? The way I invision it, a script checks to see if the user has access to edit the page, which I have done. Then the user can edit via fedI front end editor module. Now I need to display a button unpublish, a button to republish and a button to delete.

    Any guidance is appreciated.

  4. Wow, I spoke too soon.  I get the error message showing properly no, no more server error nasty page.  I simply uploaded your code as a test.  

    I get an error message in the footer since I have a link in the footer that changes logout when a user is logged in.

    I cannot login period, when I do enter the correct credentials.

    Here is what I have:

    <?php
    if($input->get->logout == 1) {
        $session->logout();
        $session->redirect("./"); // start them on a fresh page, or redirect to another
    }
    
    ?>
    
    
    
    
    
    <?php
    
     
    
    include("./head.inc"); 
    
    
    ?>
    
    <div class="row supersize">
    <div class="medium-12 columns">
    
    
    
    <div class="medium-4 columns">
    <p> </p>
    </div>
    <div class="medium-4 columns">
    
     <h1><?echo $page->title;?></h1>
    
    <?php 
    
    /**
     * Login template
     * Based on a forum contribution by Ryan, can't locate it, but the are many examples of login forms.
     * 
     */
    
    if($user->isLoggedin()) {
    	// user is already logged in, so they don't need to be here
    	$session->redirect($config->urls->root); 
    }
    
    // check for login before outputting markup
    if($input->post->user && $input->post->pass) {
    
    	$user = $sanitizer->username($input->post->user);
    	$pass = $input->post->pass; 
    
    try{
        $u = $session->login($username, $pass);
        if($u && $u->id){
            $session->redirect("/somepage/");
        }
    } catch(Exception $e) {
        echo $e->getMessage();
    }
    
    }
    
    ?>
    <p><?php if($input->post->user) echo "<div class='alert alert-error'>Username and or Password is incorrect!</div>"; ?></p>
    
    <form class="" action='./' method='post'>
    	<label style="color:#fff;" for="user">Username</label>
    	<input type="text" name="user" id="user" placeholder="Enter your username">
    	<label  style="color:#fff;" for="pass">Password</label>
    	<input type="password" name="pass" id="pass" placeholder="Enter your password">
    	<label></label>
    	<button type="submit" name="submit" class="btn btn-primary">Submit</button>
    </form>
    <p>Forgot password? <a href='/forgot-password'>Reset here.</a></p>
    </div>
    <div class="medium-4 columns">
    <p> </p>
    </div>
    </div>
    
    
    
    
    
    
    
    
    </div>
    
    
    
    
    
    <?php include("./foot.inc"); 
    
     ?> 
  5. @Ryan, do you know how I can prevent an internal server error that shows with all white screen. Basically, I created your front end login. However, if you attempt to login two times with incorrect password it throws the server error. If you login one time with incorrect values, it will toss the wrong user name message. I feel as if it's trying to display the must wait 60 seconds to login like a back end admin and cannot find it since it's a front end login. How can I fix this so I don't get the server error?

  6. @Mindfull in response: my problem is the API, as I'm not that familiar with it to make it work with my wishes, yet. I'm sure I'll get there. But yes the payment will be the last step. Right now I just made the registration form, users can now register and they are automatically given a front editor role.

    Now here is my new dilemma, I am going to add an if statement at the top of the posting ad page. To only show the page if the user is logged in or redirect them to login or register for posing privileges.

    When they are logged in, they can visit the posting page. Here they select a category to post in, that category will direct them to a category page with a form builder iframe form. Right now I am using form builder to build pages. I need help creating a way to auto assign the user to the page they just created through form builder. By auto assign I mean editing privileges.

    Note: I already setup editing privileges on a per user per page basis. Through the module. So the role frontend-editor has ability to edit pages I manually assign to it. This is where I want to make it automatic.

    Any help?

    Thanks again to everyone who has helped me walk over this bridge, I'm almost there!

  7. @mindfull I have the registration for created and it works in which they are automatically assigned frontend-editor as a role. After a user registers, they are presented with a form builder embedded form, here they can select a category to post a new page too. The form that creates a new page is by form builder as an iframe. This is where I need the help to assign editing privileges to the user that created the new page, but I want them to only be able to edit that page. Right now if we see the new user register, then submit a new page, we manually add them to edit that page. Any light on this?

  8. @kongondo , 

    So I basically did what onjegolders did accept, I removed the system email to the admin.  

    How would I go about taking the users username, possibly his password too and emailing him a welcome to blah blah blah here is your user name and password, to login go to www.example.com. 

    Any guidance on this?  

    Thanks.

    Here is the code:

    <?php
    
    include("./head.inc"); 
    ?>
    
    <?php
    
    $headings = "
    <div id='register'>
    	<div class='row'>
    		<div class='medium-12 columns supersize'>
    		<div class='medium-4 columns'>
    		<p> </p>
    		</div>
    <div class='medium-4 columns'>
    
    		<h3>Register with us</h3>";
    			
    
    			$form="<form action='./' id='registration' method='post'>
    										
    		
    
    				
    
    					<label for='username'>Username</label>
    					<p class='help'>Please ensure your username contains no spaces</p>
    					<input type='text' name='username' value='{$input->post->username}'>
    					
    					<label for='first_name'>First name</label>
    					<input type='text' name='first_name' value='{$input->post->first_name}'>
    					
    					<label for='last_name'>Last name</label>
    					<input type='text' name='last_name' value='{$input->post->last_name}'>
    					
    					<label for='email'>Email address</label>
    					<input type='text' name='email' value='{$input->post->email}'>
    
    				
    				
    					
    			  		<label for='pass'>Password</label>
    			  		<p class='help'>Please ensure your password is at least 6 characters long and contains at least one digit and one letter</p>
    				  	<input type='password' name='pass' value='{$input->post->pass}'>
    		
    				  	<label for='pass_confirm'>Confirm password</label>
    				  	<input type='password' name='pass_confirm' value='{$input->post->pass_confirm}'>
    
    		
    
    			<input class='button success small' type='submit' name='submit_registration' id='submit'>
    
    			</form>";
    
    			$message = "Please fill in the form below if you would like to register in order to receive exclusive access to our brochures and latest information.";
    
    			$usernames = array();
    
    			foreach ($users as $u) {
    			    $usernames[] = $u->name;
    			}
    
    			if($input->post->submit_registration) {
    				
    				if (empty($input->post->username) || empty($input->post->email) || empty($input->post->pass)) {
    					$message = "Please fill out all fields marked with a *";
    					echo $headings;
    					echo "<h5 class='error'>$message</h5>";
    					echo $form;
    				} 
    
    				elseif (in_array($input->post->username, $usernames)) {
    					$message = "Sorry, that username is already taken, please choose another.";
    					echo $headings;
    					echo "<h5 class='error'>$message</h5>";
    					echo $form;
    				}
    				
    				elseif (filter_var($input->post->email, FILTER_VALIDATE_EMAIL) === FALSE) {
    					$message = "Please include a valid email address";
    					echo $headings;
    					echo "<h5 class='error'>$message</h5>";
    					echo $form;
    				}
    
    
    				elseif (!preg_match("/[0-9]/", $input->post->pass) || strlen($input->post->pass) < 6) {
    					$message = "Please ensure your password has at least one digit and is at least 6 characters long";
    					echo $headings;
    					echo "<h5 class='error'>$message</h5>";
    					echo $form;
    				}
    
    				elseif($input->post->pass !== $input->post->pass_confirm) {
    					$message = "Please ensure that your passwords match";
    					echo $headings;
    					echo "<h5 class='error'>$message</h5>";
    					echo $form;
    				} 
    
    				else {
    					echo $headings;
    					$message = "Congratulations! You have successfully registered!";
    					echo "<h5 class='success'>$message</h5>";
    					echo "<h4><a href='/login' class='button'>LOGIN</a></h4>";
    
    					$u = new User();
    					$u->of(false);
    		            $u->name = $sanitizer->username($input->post->username);
    		            $u->first_name = $sanitizer->text($input->post->first_name);
    		            $u->last_name = $sanitizer->text($input->post->last_name);
    		        	$u->email = $sanitizer->email($input->post->email);
    		            $u->pass = $sanitizer->text($input->post->pass);
    		            $u->addRole('frontend-editor');
    		            $u->save();
    		            $u->of(true);
    
    					
    					
    
    				}
    				
    			} elseif ($user->isLoggedin()) {
    				echo $headings;
    				echo "<h5>No need to register " . $user->get('first_name|name') . ", you are already are!   <a href='{$config->urls->root}'>Click here</a> if you would like to return to the homepage.</h5>";
    			}
    
    			else {
    				echo $headings;
    				echo "<h5>$message</h5>";
    				echo $form;
    			} 
    			
    
    			?>
    	
    			
    			
    			
    			
    						</div>
    			<div class='medium-4 columns'>
    		<p> </p>
    		</div>
    			</div>
    
    		</div>
    
    <?php 
    
    ?>
    
    <?php include("./foot.inc");
    
    
×
×
  • Create New...