Jump to content

vxda

Members
  • Posts

    169
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by vxda

  1. Hi. On my new site i have 2 ways users can login / register. First is a normal way = input email and pass second is facebook login i used apeisa module for that : http://modules.processwire.com/modules/facebook-login/ . But i changed it a bit to suit my needs ie.: User has registered with normal form, so his acc is created, next time user wants to login with facebook. so im looking for his email address then i populate his account with new data from facebook and im login him in. Thing is that i need to input his password for that, module itseld generates new password on every login. Im trying to prevent this to happend, so that user can login in a normal way anytime he wants. now when im trying to use: $session->login($u->name, $u->pass); it does not work. it works only when i attatch a new password to him. // First we create random pass to use in login $uniqid = uniqid(); $pass = sha1($uniqid . $id . $fbUserData->updated_time); // User has logged in earlier with facebook id, great news let's login if ($u->id) { $u->of(false); $u->pass = $pass; $u->addRole(self::name); $u->save(); } My question ... Is there a way to login user without changing his pass on each login ? Cheers
  2. cool get it. well im a module starter myself, i know there is some way to enable settings button on a module and then u could choose all options there but i dunno how . but ye hardcoded stuff is bad for a module.
  3. why ? i found that page names are changing more offten then page id. thats why i use id. Thx for the code
  4. i sticking with $pages->get(1); i like using id's instead of names.
  5. nice ajaxcrawler . Trying to use historyApi on my site aswell.
  6. Here is the code for module that sends email to page creator, once the page is moved from one parent to another. <?php require_once("/site/templates/phpmailer/class.phpmailer.php"); class sendMail extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Notify module', 'version' => 101, 'summary' => 'Send email after pages is moved to another parent', 'singular' => true, 'autoload' => true ); } public function init() { $this->pages->addHookAfter('Pages::saveReady', $this, 'sendMailOnChange'); } public function sendMailOnChange($event) { $page = $event->arguments[0]; if(!$page->parentPrevious) return; // if page is not being moved then stop now // When page is moved outside its parent but not trash if(($page->parent->id != 1286 && $page->parent->id != 7) && $page->parentPrevious->id == 1286) { //Email address of user that created page $userEmail = $page->createdUser->email; //Message that appears after page is moved $this->message("Mail was sent to :{$page->createdUser->name} at his email address: {$userEmail}"); $mail = new PHPMailer(); $mail->IsHTML(true); $mail->isSMTP(); $mail->Debugoutput = 'html'; $mail->Host = "YOUR HOST"; $mail->Port = 25; $mail->SMTPAuth = true; $mail->CharSet = "UTF-8"; $mail->Username = "EMAIL ADDRESS OF MAILBOX U WANT TO SEND MESSAGE FROM"; $mail->SetFrom("I USE SAME AS ABOVE $mail->Username"); $mail->Password = "PWD TO YOUR MAILBOX"; $mail->FromName = "STRING FROM"; $mail->AddAddress($userEmail); $mail->Subject = __("YOUR MESSAGE IS MOVED"); $mail->Body = "Hello: {$page->createdUser->name} <br />". __("your post has been moved !!"). "<br />". "You can find it here: <a href='{$config->httpHost}{$page->url}'>{$config->httpHost}{$page->url}</a>"; ; $mail->send(); } } } ?> I used phpmailer since im using it from the begining of project. If u can please show how would same function look with wireMail(); Cheers !
  7. hi im trying to send email to user after page he created has been moved to another parent/ I found this on forum : https://processwire.com/talk/topic/1705-need-to-send-email-notification-after-a-page-has-been-published/ i want to do exacly what Ryan described in Option 2. but i have no idea how hooks works. I was trying to do this from my template. in my file header.inc require("phpmailer/class.phpmailer.php"); function sendMailOnChange(HookEvent $event) { $page = $event->arguments[0]; if(!$page->parentPrevious) return; // if page is not being moved then stop now if($page->parent->id != 1286 && $page->parentPrevious->id == 1286) { $mail = new PHPMailer(); .... } } function init() { wire()->addHookAfter('Page::saveReady', $this, 'sendMailOnChange'); } Please explain to me how do i use hooks from my template files. Thank you
  8. Hi Adrian i think i found a bug in your module. its not working when in the link there is "#t=50". Example: https://www.youtube.com/watch?v=aBEEnbXZMwo#t=50 #t=50 is the time, on which player starts the video.
  9. Check this out: https://processwire.com/talk/topic/1293-how-to-set-unpublished-for-a-page-in-the-api/?p=11538
  10. Found a solution here on forum How to create a pagination with a custom pageArray. https://processwire.com/talk/topic/5558-adding-pagination-after-merging-two-pagearrays/?p=54120
  11. Anyone got some idea how to solve this ? pls ?
  12. hmm i was trying to cheat that pager a bit and i did something like this: detecting what page im on with: $input->pageNum and then acording to that im setting offset of my pageArray $offset = 0; if ($input->pageNum > 1) { $offset = $input->pageNum * 25 - 25; } and it started sorting news properly, but now the pagination links are down, after i go after /page2 it thinks his still on /page2 next page link shows allways /page2 $news= $news->find("start=".$offset.", limit=25"); Strange thing is that $input->pageNum show correctly on wich page i am. so there has to be something wrong with renderPager $pagination .= $news->renderPager();
  13. here is my code: $allText = $pages->find("template=news, text_yes=1, sort=-created"); // Here im grabbing all special news if ($page->id === 1) { // If in home page $news= $pages->find('has_parent=1020, template=news, sort=-created, text_yes=0'); // Here im grabbing all normal news withour specials $count=1; $afterArr = array(); foreach ($news as $item) { // Here im lookin for page id of every 6th news for later. if ($count % 6 == 0) { array_push($afterArr, $item); } $count++; } $i = 0; foreach ($allText as $textPage) { if ($i < count($afterArr)) { $news = $news->insertAfter($pages->get($textPage->id), $pages->get((string)$afterArr[$i])); // Here im inserting special news pages on every 6th normal news item. $i++; } } $news = $news->find('template=news, limit=25'); // here im setting item limit for each page }else { $pa = $page->children('template=news, sort=-sort, limit=25'); // here will be option when not in homepage } foreach ($news as $newsItem ) { if ($newsItem ->text_yes == "1") { $out .= SPECIAL NEWS } if ($newsItem ->text_yes == "0") { NORMAL NEWS } } $pagination = ''; $pagination .="<nav class='pagination'>"; $pagination .= $news->renderPager(); $pagination .="</nav>";
  14. Thx Adrian for your replay, it looks like its working but ... i got same news on every page something wrong with pagination now ;/ i got url/page2 and so one but got same news list on every page
  15. i have same problem with my pageArray, its get meessed up after : $pageArray= $pages->find('template=news, limit=25'); Cant find solution to this.
  16. I think im getting closer to solution. Im creating new page array and i put all pages in the order i want them to be displayed $pa = new PageArray(); $pa->import($news); thing is that when im doing this to limit them per page, it automaticly gets reordered. Is there a way to prevent it from getting reorded ? $pa = $pages->find(template=news, limit=25);
  17. Hi my problem is a bit complicated, first the data structure. NEWS Category 1 News 1 News 2 ... Category 2 News 1 News 2 ... and so on. My news template can be shown in 2 ways *as a news : checkbox text_yes=0 *as important news:checkbox text_yes=1 On home page im showing all news from all categories also im showing important news(text_yes=1) on every 7th item. Im grabbing pages like this : $news= $pages->find('has_parent=1020, template=news, sort=-created, text_yes=0, limit=25'); Then im creating array to populate it with every 7th news item $afterArr = array(); foreach ($news as $item) { if ($count % 7 == 0) { array_push($afterArr, $item); } $count++; } Now im looking for all news from all categories that are text_yes=1 $allText = $pages->find("template=news, text_yes=1, sort=-created"); Now im updating my pageArray with important news $i = 0; foreach ($allText as $textPage) { if ($i < count($afterArr)) { $news= $news->insertAfter($pages->get($textPage->id), $pages->get((string)$afterArr[$i])); $i++; } And now im getting confused cause my pagination dont work properly normal news are pagin good but my important news are repeating on each page. so what i was trying to do is to get my pagesArray into array and then into string: First of all i changed limit of grabed news to null $news= $pages->find('has_parent=1020, template=news, sort=-created, text_yes=0'); then $pagesArr = $news->getArray(); $p = implode('|', $pagesArr); and then use it like this : $news= $pages->find('id='.$p .',template=news, limit=25'); first page is wroking, second page shows all news on one page. my foreach looks like this : foreach ($news $item) { if ($item->text_yes == "1") { $out .="important news"; } if ($item->text_yes == "0"){ $out .="news"; } } im a beginner php so have a fealing like im overdoing something here. Would be grateful for help in this. i hope i explained all clearly Cheers Pawel
  18. Hah u have nothing to sorry about , i thank you for your work and time . I downloaded newest version from gitbub and it works perfectly thank you again.
  19. Yep module works fine when im saving page thru admin panel video field = video images = video_imgs
  20. It did worked ty Adrian, but now module for grabbing images of videos wont populate field with images.
  21. Im trying to add video links thru api im checking if the url is from youtube or vimeo then im doing : if($videoUrl) { $np->video = $sanitizer->textarea($url);} but in result on the page i got url string, if i save page from admin site then its formated to video player. Any way to fix this ?
×
×
  • Create New...