![]() |
Ion Auth - Lightweight Auth System based on Redux Auth 2 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Ion Auth - Lightweight Auth System based on Redux Auth 2 (/showthread.php?tid=27435) Pages:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-27-2011 [eluser]malcomhfc[/eluser] Ben when i echo $user i just get Array. Im trying to insert the logged in user into the database table website(for comment system and learning purposes. I know it looks bad but im learning ![]() Code: if($this->comment_m->addWebsite(array('doWebsite' => $this->input->post('doWebsite'), 'doUser' => $this->ion_auth->user()->result_array()))) Also tried to do it with out result_array Code: if($this->comment_m->addWebsite(array('doWebsite' => $this->input->post('doWebsite'), 'doUser' => $this->ion_auth->user()->result()))) Any idea why the output is Array? Code: Error Number: 1054 Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-27-2011 [eluser]Ben Edmunds[/eluser] malcomhfc, You probably only want to insert the user id. You can't stick an array in a DB field without serializing it, and that is bad practice for most situations. Are you using Ion Auth v1 or v2? v1 code is: Code: $user = $this->ion_auth->get_user(); v2 code is: Code: $user = $this->ion_auth->user()->result(); Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-27-2011 [eluser]malcomhfc[/eluser] I just get the error Code: A PHP Error was encountered the line is the one above ^. Im using version 2 for ion_auth. I take it the problem could just be my code in the model? its just a simple function Code: function addDomain($options = array()) Thanks a lot for your assistance Ben ![]() Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-27-2011 [eluser]Ben Edmunds[/eluser] malcomhfc, It could be because I gave you the wrong v2 code ![]() Code: $user = $this->ion_auth->user()->row(); If that doesn't work, please answer these questions: 1. What's on line 32? 2. Are you sure your logged in? 3. What do you get if you var_dump($user)? 4. What do you get if you do: Code: var_dump($this->ion_auth->current()->user()->row()); Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-27-2011 [eluser]malcomhfc[/eluser] Ah that worked thank you. Using the correct code helps most times ![]() Was that in the docs and i have missed it or is there new docs to be released once ion_auth 2 is finished? dont know php well enough to look through your library and see the correct usage ![]() Thanks again Ben. Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-27-2011 [eluser]Ben Edmunds[/eluser] malcomhfc, Awesome, that does usually help, haha. v2 is still alpha so no docs yet. Once I feel it has been tested enough and has most all of the features I want to add I'll write up some new docs. Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-27-2011 [eluser]malcomhfc[/eluser] $user = $this->ion_auth->user()->row(); does this work for the logged in user running the function? What im doing is Code: 'comment' => $this->comment_m->getWebsite((array('doUser' => $user->id)))); what its supposed to do is get all the records with field id matching the user id. What actually seems to happen is that it defaults to user 1. The function seems to work but i think im using wrong ion_auth code since it seems to think id 1. Was just wondering if there was another bit of code to use? If not only one way to learn to debug, right? ![]() --think its best for me to download version 1. ![]() thanks. ![]() Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-28-2011 [eluser]Ben Edmunds[/eluser] Sorry for the confusion, that will just return the first user, to pull the currently logged in user do this: Code: $user = $this->ion_auth->current()->user()->row(); If you want to pull a different user by id you can do: Code: $user = $this->ion_auth->user($user_id_to_query)->row(); Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-29-2011 [eluser]malcomhfc[/eluser] works perfect thanks again ![]() Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 05-29-2011 [eluser]jark[/eluser] I'm having some trouble just getting the default reset password link to work. I configured ion_auth to use username as the identity, but the problem persists even if I change the identity to email. If I surf to auth/forgot_password and enter in a valid identity - an identity I've used to successfully login with - the following errors are spit out: Code: A PHP Error was encountered It does not matter the usage/configuration combo for identity. If configured for username, if I enter either username or password (even though it explicitly asks for a password) it errors out. The same happens when configured for email. I've not made any changes to the library file, but here are the applicable lines: Code: 195: 'identity' => $user->{$this->ci->config->item('identity', 'ion_auth')}, Any ideas what I either might be doing wrong or could do to fix? Thanks in advance! |