Jump to content

Frank Vèssia

Members
  • Posts

    584
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Frank Vèssia

  1. solved, I don't know why but the template had the option "Use Compiled File" off
  2. Hi guys, I'm trying to integrate the facebook sdk to register/login users but I'm getting a strange error when I try to create a new user after I get the facebook token. Fatal error: Class 'User' not found in /var/www/vhosts/httpdocs/site/templates/social_fb_callback.php on line 41 it's possible the facebook sdk interferes with pw classes? this is the complete code. I'm on PW 3.0.10 <?php require_once('../Facebook/autoload.php'); $fb = new Facebook\Facebook([ 'app_id' => 'xxxxx', 'app_secret' => 'xxxxx', 'default_graph_version' => 'v2.5', ]); $helper = $fb->getRedirectLoginHelper(); try { $accessToken = $helper->getAccessToken(); } catch(Facebook\Exceptions\FacebookResponseException $e) { // When Graph returns an error echo 'Graph returned an error: ' . $e->getMessage(); exit; } catch(Facebook\Exceptions\FacebookSDKException $e) { // When validation fails or other local issues echo 'Facebook SDK returned an error: ' . $e->getMessage(); exit; } if (isset($accessToken)) { // Logged in! $session->facebook_access_token = (string) $accessToken; // OAuth 2.0 client handler $oAuth2Client = $fb->getOAuth2Client(); // Exchanges a short-lived access token for a long-lived one $longLivedAccessToken = $oAuth2Client->getLongLivedAccessToken($session->facebook_access_token); $token_fb = $sanitizer->selectorValue($session->facebook_access_token); $checkUser = $users->get("token_fb=$token_fb"); if($checkUser instanceof NullPage){ // new user try { $fb->setDefaultAccessToken($session->facebook_access_token); $res = $fb->get('/me?fields=first_name,last_name,email'); $userNode = $res->getGraphObject(); // get profile picture $res = $fb->get( '/me/picture?type=large&redirect=false'); $picture = $res->getGraphObject(); // get email if($userNode->getProperty( 'email' ) == ''){ $uemail = "tocomplete"; }else{ $uemail = ""; } $nome = $userNode->getProperty( 'first_name' ); $cognome = $userNode->getProperty( 'last_name' ); $pass = "vogliadi".rand(100,10000); // creo username dal nome e cognome e se esiste aggiungo un numero alla fine. $username = strtolower($nome).strtolower($cognome); $checkuser = $users->get("name=$username,token_fb!=$session->facebook_access_token"); if($checkuser->id){ $username = $username.rand(10,100); } //registro utente $u = new User(); $u->name = $username; $u->pass = $pass; $u->passclear = $pass; $u->email = $uemail; $u->nome = $nome; $u->cognome = $cognome; $u->token_fb = $session->facebook_access_token; $u->privacy_newsletter = 1; $u->addRole("guest"); $u->addRole("member"); if($u->save()){ $u->profilepic = $picture['url']; $u->save(); $session->login($u->name,$u->pass); } $session->redirect("/",false); } catch(Facebook\Exceptions\FacebookResponseException $e) { // When Graph returns an error echo 'Graph returned an error: ' . $e->getMessage(); exit; } catch(Facebook\Exceptions\FacebookSDKException $e) { // When validation fails or other local issues echo 'Facebook SDK returned an error: ' . $e->getMessage(); exit; } }else{ // login $session->login($checkUser->name,$checkUser->password); $session->redirect("/",false); } }
  3. Maybe I found a solution can be useful to others. When a user register I have a field with an auth code so the user must check his email and click on a link to verify the account. I can recycle this field and after the verification process I can simply set as "firstlogintogo" or whatever I can check after login and clear after the first login.
  4. There is an internal field or a way to detect the first user login after I created it via API? I usually create a dedicated field/checkbox for this but I'm wondering if I can use some internal way avoid to add a field to the user template.
  5. Hello gyus, I recently update one website from pw 2.7 to 3.0.10 and I'm getting a strange error, the code is this one $check_vid = $config->paths->root."video/111.mp4"; if ( file_exists($check_vid)){ do things } I get this error Fatal error: Exception: Download URLs must begin with http:// or https:// (in /home/disinibi/public_html/tube/wire/core/WireHttp.php line 576) any Idea why it's trying to download the file?
  6. yep I know it's messy but I need those pages directly under the home...my SEO requested so... and I don't want to create some htaccess tricks to remove the container page between home and those pages
  7. I'm having some issue with the new page tree. I have 163 home's children (+8k pages). In the first page it works fine if I open a page, go anywhere and come back, but is not working for paginated pages. Screen capture video http://sendvid.com/vyi8nkb2
  8. I noticed a "bug" maybe.. I removed "#_ProcessPageEditChildren" for the "selector to hide" option because I want to add childrens but inside the popup when I click to "add new page" button I can see the new page form for just one sec and then the popup closes
  9. This module is amazing...I'm gonna test very soon for sending emails after user actions.
  10. Hi, just installed, I got this Notice: Undefined index: fieldHighlightStyle in /var/www/vhosts/httpdocs/site/assets/cache/FileCompiler/site/modules/FrontEndEditLightbox/FrontEndEditLightbox.module on line 167 I'm on PW 3.0.5 devns Update: sorry, the notice gone after I changed the module configs...
  11. Nice module, I see I can get the current user's vote but what about a given user's vote?
  12. thanks, anyway the problem was related to the module itself, some init issue, I uninstalled the module and reinstalled and now it works
  13. mmm, i tried to include those files (at least Comment.php) but still i got "Class 'Comment' not found"...
  14. it doesn't work, i tried wire('modules')->get('Comments') and wire('modules')->get('FieldtypeComments') I also tried $c = FieldtypeComments::Comment()
  15. mmm you are right... but how? Usually I use other module's methods but comment module doesn't have a "new()" like method so I'm not quite sure how to make this
  16. I'm trying to create a comment inside a module function but I got error "Class 'Comment' not found" public function postComment($pageid){ $input = wire('input'); $user = wire('user'); $sanitizer = wire('sanitizer'); $pages = wire('pages'); if($input->post->rv_text && $user->isLoggedin() && $pageid != ''){ $c = new Comment(); ... } }
  17. Hi, out of the sudden I got this error in two websites Error: Exception: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' (in /home/isoladel/public_html/wire/core/Database.php line 114)) any idea of what is it?
  18. Yes I confirm, I uninstalled the module and reinstalled again and the error gone, sorry for that.
  19. thanks for the reply, yes I'm gonna use that module, I already used in the past. regarding the "display of favs" I will show both, the picture page will display all users that added that picture, and in the profile page each user will display the list of favorite pictures, I think the real questions is: there will be more users of pictures in the database? or it doesn't matter for the query? option A (favs field inside user template) user profile $user->favs->count() picture page $users->count("favs={$page->id}") or find("favs={$page->id}") option B (favs field inside picture template) user profile $pages->find("template=picture,favs=$user") picture page $page->favs->count()
  20. Hi guys, just a simple logic question: I'm going to create a list of favorites pictures for each user, using a page field. my question is: it's better to add a page field to the user template and add all favorites pictures there, or add the page field to the picture template and add there the list of all users that added that picture?
  21. Hi, I just installed the latest version 1.5.1 on PW devns 3.0.3 (fresh install) and I got this warning Failed to init module: ProcessJumplinks - SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'last_hit'
  22. I've recently moved my website to another server and now wiremailsmtp doesn't work anymore, it display this message: Warning: stream_socket_enable_crypto(): Peer certificate CN=`email-smtp.eu-west-1.amazonaws.com' did not match expected CN=`52.19.6.114' in /home/sodd/public_html/site/modules/WireMailSmtp/smtp_classes/smtp.php on line 1255 any idea? thanks
  23. I've already used online page speed test but they got on timeout...
×
×
  • Create New...