Jump to content

Vineet Sawant

  • Content Count

  • Joined

  • Last visited

Community Reputation

76 Excellent

About Vineet Sawant

  • Rank
    Sr. Member
  • Birthday 04/18/1989

Contact Methods

  • Website URL
  • Skype

Profile Information

  • Gender

Recent Profile Visitors

7,490 profile views
  1. Wooh... 4 years later, I'm still using PW, lovely! After recently using PW 3.0, I've leart that reducing the number of fields in the entire project is a good way of making sure the fields are being used effectively and efficiently. It also helps in remembering the fields names easily while writing code. Based on this, my latest coding strategy is to create a field of each type of field and reusing them on various templates. It helps in standardizing the field names as well as makes coding faster & easier.
  2. foreach($users as $u) Worked. I figured that since I was setting content type header as json, that's why HTML was not working. Though I've been using PW for long, there's still a lot to learn. Something new learnt today, thanks a lot mate.
  3. Alrighty, so here's the latest update. I tried changing the template of the api page to something else. It's working when I change the template. Also I tried to add some simple HTML to the page, it's not rendering, rather it's just showing it as plain text. I suppose there's something wrong with the encoding of the page. Wil change the file & try again. EDIT: So I checked, I changed the template file, created new from scratch. Whenever I'm trying to print anything other than HTML, it's not working for guest user. I suppose, the results that I'm getting from the selector, are only available to logged in users. EDIT #2: So it's only happening if I'm using user template as selector. I changed that to basic page and it's working fine even for guest user. I suppose this is PW's way of keeping things secure but is there anyway to bypass this?
  4. <?php header('Access-Control-Allow-Origin: *'); $callback = isset($_GET['callback']) ? preg_replace('/[^a-z0-9$_]/si', '', $_GET['callback']) : false; header('Content-Type: ' . ($callback ? 'application/javascript' : 'application/json') . ';charset=UTF-8'); $users = $pages->find("template=user,include=hidden"); foreach ($users as $u) { $usersList[] = array("id" =>"{$u}","name" =>"{$u->name}","email" =>"{$u->email}"); } $json_encoded = json_encode($usersList); $jsonp_callback = isset($_GET['callback']) ? $_GET['callback'] : null; print $jsonp_callback ? "$jsonp_callback($json_encoded)" : $json_encoded; Here's my code. Even if I try to just print simple loop with username, it's only visible to logged in user and not to anyone else.
  5. Hi, I've been using PW for a pretty long time now, and this kind of thing is happening for the very first time. I'm setting up an API for the App I'm creating for my client. So I've created a hidden page called API which is located right under the Home. When I'm trying to write code for API and test it, the output is only visible for logged in user, i.e., the output is only available if I'm logged in, which is not going to be the case when I'm using app to request JSON. So, question is, how to keep the page hidden but accessible to guest user? I checked the permissions under settings tab. Who can access this page? Tab says it's accessible to guest & superuser but for some reason, it's only working for superuser. What am I doing wrong? Thanks.
  6. Wow, still no response. I must have asked either a really tough or really stupid question.
  7. Hi, I'm working on a simple Ionic app which is going to use ProcessWire as the backend. This app allows people to upload images and then like/comment on them. It's a lot like a stripped down imgur app. I've set up some basic services such as register, login & reset password. There are a couple of things I am doubtful about. 1. How do I get user's unique session Id once he's successfully authenticated through AngularJS's http post request? I'm currently using following code: $sessions = $session->getAll(); $session_id = $session->_user["fingerprint"]; But I'm not sure if that's the right way to do it. I'm not even sure if that's the session id. I know there's something called SessionCSRF["name"], I tried that. I'm sending session_id as response to http post request. Then I'm using that session id to check if user is authenticated for his/her further actions such as commenting/liking/posting etc. 2. Now that I've got the session id, how do I identify the user based on the given session id? or should I send user ID back to PW everytime user is performing any action? Is it possible to identify user just based on the session fingerprint that I'm giving back to the app? Among other things I'm considering are keeping a device id on the server for each user, so as to gain better control over user's sessions. I can log out all the devices linked at once etc. I'd really love to hear from you guys how you'd plan to do this app. I'm experienced with PW but not very much with AngularJS. Thank you.
  8. I ended up using limit with foreach & pagination. I also found out that start=n in the selectors breaks pagination module. It stops working. Pagination renders page numbers but after clicking the page, e.g., 3 still shows data from page 1. I guess it happens cause I'm using start=n. When I removed, it started working just fine.
  9. Hello, I've a website with over 40k registered users who sign up using their email IDs. We've a ticket booking service and we wish to alert users about certain functionality changes in the site. Whenever I'm trying to print all the email using foreach, page is going blank due to memory issue I suppose (it takes ages to respond). Is there any way or any module which will export all the emails to a single CSV file? Thanks.
  10. Oh right, I found it. It makes a lot of sense now.
  11. Hi diogo, I was thinking about the notifications that PW's admin theme uses. I guess you are talking about the same thing, ain't you? I will try your suggestion on a staging pw installation. Yesterday I gave up and wrote sql queries (which I absolutely hate to do) to store all the activity in a table called activity. Then once they are shown to user, I change the activity status to read from unread. Since it's a different table, I don't have to worry about wasting page ids. Thank you all for your inputs.
  12. What exactly is WireCache and where can I read more about it? Yes, I guess I should make a table to store notifications.
  13. Thanks for your reply renobird. No, topics are permanent unless owner of the topic deletes it. The temp pages are for notifications which I want to give to the owner of the topic if someone comments or does any of other activities like adding post to favourites etc. So basically, it's like facebook's notifications. Consider you post a photo & people are comments & liking the picture, how am I to give you notifications? I've to store all this comments/liking activity somewhere right? I've figured out a way to store comments & likes, it's just the notifications of it, which is a temporary thing, that I've to figure out. It can be done by creating temp notification pages and add them to a notifications page array field of the post and then just check the notification status and show user the unread pages as notifications. But this way I'm wasting hell lot of page IDs. Which would be an inefficient thing to do, right? So that's where my question comes from, how do I manage temporary storage? May be PW should provide temp pages other than usual pages with all the same features. Sorry for the long story.
  14. Hello everyone, I'm creating a large scale application which will be used by thousands of people. Part of of the application requires storing temporary information about user's activities. For example, if user comments on certain topic, notification of same should be given to OP and people following the topic. I thought I'd create a subpage with a repeater field having few fields like user id, timestamp & notification status, read/unread (I just don't see why using page table is better in this case, if someone can enlighten me, that'd be great.). But I've read that every repeater item is same as new page, so I'm really confused whether I should just start keeping temporary pages or use a page with repeater field. But for every topic, there can be hundreds of notifications, which I think will be a problematic situation in future. So I am looking for any kind of temporary storage that will not included creating pages. Writing logs to file could be done but i'm not sure how good solution is that and how reliable it'll be. I'd really like a good conversation with someone who understands PW, so I'm here. Thank you all.
  • Create New...