Yii Framework Forum: Instapaper/pocket Like Bookmarklet - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Instapaper/pocket Like Bookmarklet Rate Topic: -----

#1 User is offline   shii 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 08-March 13

Posted 05 April 2013 - 12:34 PM

Hello everybody,

I am trying to write a bookmarklet like Instapaper or Pocket(Read it later) uses in order to transfer data of the current page to my app.
When I click on the bookmarklet I insert this Javascript Snippet in to the header of the current site (could be any website):

<script src="http://mysite.com/index.php?r=entries/submits&u=http%3A%2F%2Fwww.google.com%2F&t=Google">


With this snippet i am able to connect to my controller which will return Javascript code:

public function actionSubmits()
{
	if(Yii::app()->user->isGuest){
		echo 'alert("not logged in");';
		return;
	}
...
}


Now the Problem is, although I am logged in as a user I always get alerted that i am not logged in which means that Yii::app()->user->isGuest returns true although I am logged in. Why is that so?

Any help would be greatly appreciated.
0

#2 User is offline   hiral darji 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 27
  • Joined: 31-May 12
  • Location:Ahmedabad

Posted 05 April 2013 - 01:45 PM

View Postshii, on 05 April 2013 - 12:34 PM, said:

Hello everybody,

I am trying to write a bookmarklet like Instapaper or Pocket(Read it later) uses in order to transfer data of the current page to my app.
When I click on the bookmarklet I insert this Javascript Snippet in to the header of the current site (could be any website):

<script src="http://mysite.com/index.php?r=entries/submits&u=http%3A%2F%2Fwww.google.com%2F&t=Google">


With this snippet i am able to connect to my controller which will return Javascript code:

public function actionSubmits()
{
	if(Yii::app()->user->isGuest){
		echo 'alert("not logged in");';
		return;
	}
...
}


Now the Problem is, although I am logged in as a user I always get alerted that i am not logged in which means that Yii::app()->user->isGuest returns true although I am logged in. Why is that so?

Any help would be greatly appreciated.


write return false; otherwise remove return from there.
0

#3 User is offline   shii 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 08-March 13

Posted 06 April 2013 - 06:11 AM

View Posthiral darji, on 05 April 2013 - 01:45 PM, said:

write return false; otherwise remove return from there.

that won't make any difference.

1. I am using echo and not return for transfering data to the Javascript Snippet
2. I am using return to stop the current execution
3. Yii still identifies me as a guest although i am logged in

Any other suggestions?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users