ข่าว IT ล่าสุด
ถูกใจอย่าลืม Like Fanpage
$memberContext array in SMF
แสดงแล้ว 3293 ครั้ง /
กันยายน 29, 2010, 08:29

Moshi

ออฟไลน์
กระทู้ : 16,996
คะแนนขอบคุณ : 45
it4x สังคมแห่งการเรียนรู้
$memberContext array in SMF

มือใหม่อาจจะงงๆ นิสนึงนะครับ แต่ถ้ามือเก่าแล้วจะเข้าใจเอง

ลองเอาไปเขียนประยุกต์ใช้กับ index.template.php ดูนะครับ เกิดบางคนอยากเรียกข้อมูล User


โค๊ด: [Select]
global $memberContext, $user_info, $sourcedir;

โค๊ด: [Select]
require_once($sourcedir . &#39;/Load.php&#39;);<br />&nbsp; &nbsp; &nbsp; loadMemberData($user_info[&#39;id&#39;]);<br />&nbsp; &nbsp; &nbsp; loadMemberContext($user_info[&#39;id&#39;]);
โค๊ด: [Select]
$memberContext[$user_info[&#39;id&#39;]][&#39;username&#39;] = gets users membername<br />$memberContext[$user_info[&#39;id&#39;]][&#39;name&#39;] = gets users real name<br />$memberContext[$user_info[&#39;id&#39;]][&#39;id&#39;] = gets users id, but better to just use $user_info[&#39;id&#39;] instead<br />$memberContext[$user_info[&#39;id&#39;]][&#39;is_buddy&#39;] = returns whether or not user is buddy<br />$memberContext[$user_info[&#39;id&#39;]][&#39;is_reverse_buddy&#39;] = reverses the buddy list<br />$memberContext[$user_info[&#39;id&#39;]][&#39;buddies&#39;] = gets all buddies from that user<br />$memberContext[$user_info[&#39;id&#39;]][&#39;title&#39;] = gets the users title<br />$memberContext[$user_info[&#39;id&#39;]][&#39;href&#39;] = returns a link to that users profile only<br />$memberContext[$user_info[&#39;id&#39;]][&#39;link&#39;] = returns users name as a link to their profile<br />$memberContext[$user_info[&#39;id&#39;]][&#39;email&#39;] = gives you the users email address<br />$memberContext[$user_info[&#39;id&#39;]][&#39;show_email&#39;] = determines whether to show or hide that users email address<br />$memberContext[$user_info[&#39;id&#39;]][&#39;registered&#39;] = determines if a user is registered, if so, will return time and date when they registered, otherwise, Not Applicable text.<br />$memberContext[$user_info[&#39;id&#39;]][&#39;registered_timestamp&#39;] = returns date and time user registered<br />$memberContext[$user_info[&#39;id&#39;]][&#39;blurb&#39;] = returns the text that the user has typed into the Personal text area in their profile<br />$memberContext[$user_info[&#39;id&#39;]][&#39;gender&#39;][&#39;name&#39;] = returns text whether user is male or female<br />$memberContext[$user_info[&#39;id&#39;]][&#39;gender&#39;][&#39;image&#39;] = returns image representing either male of female of that user.<br /><br />$memberContext[$user_info[&#39;id&#39;]][&#39;website&#39;][&#39;title&#39;] = returns text for users website via their profile<br />$memberContext[$user_info[&#39;id&#39;]][&#39;website&#39;][&#39;url&#39;] = returns href for users website via their profile<br /><br />$memberContext[$user_info[&#39;id&#39;]][&#39;birth_date&#39;] = returns users Birthday as string<br />$memberContext[$user_info[&#39;id&#39;]][&#39;signature&#39;] = returns users signature via profile<br />$memberContext[$user_info[&#39;id&#39;]][&#39;location&#39;] = returns users location via profile<br /><br />$memberContext[$user_info[&#39;id&#39;]][&#39;icq&#39;][&#39;name&#39;] = returns icq name<br />$memberContext[$user_info[&#39;id&#39;]][&#39;icq&#39;][&#39;href&#39;] = returns icq href<br />$memberContext[$user_info[&#39;id&#39;]][&#39;icq&#39;][&#39;link&#39;] = returns name as a link to href with image for icq.<br />$memberContext[$user_info[&#39;id&#39;]][&#39;icq&#39;][&#39;link_text&#39;] = returns name as a link to href without image for icq.<br /><br />$memberContext[$user_info[&#39;id&#39;]][&#39;aim&#39;][&#39;name&#39;] = returns aim name<br />$memberContext[$user_info[&#39;id&#39;]][&#39;aim&#39;][&#39;href&#39;] = returns aim href<br />$memberContext[$user_info[&#39;id&#39;]][&#39;aim&#39;][&#39;link&#39;] = returns name as a link to href with image for aim.<br />$memberContext[$user_info[&#39;id&#39;]][&#39;aim&#39;][&#39;link_text&#39;] = returns name as a link to href without image for aim.<br /><br />$memberContext[$user_info[&#39;id&#39;]][&#39;yim&#39;][&#39;name&#39;] = returns yim name<br />$memberContext[$user_info[&#39;id&#39;]][&#39;yim&#39;][&#39;href&#39;] = returns yim href<br />$memberContext[$user_info[&#39;id&#39;]][&#39;yim&#39;][&#39;link&#39;] = returns name as a link to href with image for yim.<br />$memberContext[$user_info[&#39;id&#39;]][&#39;yim&#39;][&#39;link_text&#39;] = returns name as a link to href without image for yim.<br /><br />$memberContext[$user_info[&#39;id&#39;]][&#39;msn&#39;][&#39;name&#39;] = returns msn name<br />$memberContext[$user_info[&#39;id&#39;]][&#39;msn&#39;][&#39;href&#39;] = returns msn href<br />$memberContext[$user_info[&#39;id&#39;]][&#39;msn&#39;][&#39;link&#39;] = returns name as a link to href with image for msn.<br />$memberContext[$user_info[&#39;id&#39;]][&#39;msn&#39;][&#39;link_text&#39;] = returns name as a link to href without image for msn.<br /><br />$memberContext[$user_info[&#39;id&#39;]][&#39;real_posts&#39;] = returns posts<br />$memberContext[$user_info[&#39;id&#39;]][&#39;posts&#39;] = returns posts a little differently<br />$memberContext[$user_info[&#39;id&#39;]][&#39;avatar&#39;][&#39;name&#39;] = returns name of avatar<br />$memberContext[$user_info[&#39;id&#39;]][&#39;avatar&#39;][&#39;image&#39;] = returns link of avatar image<br />$memberContext[$user_info[&#39;id&#39;]][&#39;avatar&#39;][&#39;href&#39;] = returns name as a link to the avatar image<br />$memberContext[$user_info[&#39;id&#39;]][&#39;avatar&#39;][&#39;url&#39;] = returns avatar url<br /><br />$memberContext[$user_info[&#39;id&#39;]][&#39;last_login&#39;] = returns time/date of last login by that user.<br />$memberContext[$user_info[&#39;id&#39;]][&#39;last_login_timestamp&#39;] = returns last login timestamp by that user.<br />$memberContext[$user_info[&#39;id&#39;]][&#39;karma&#39;][&#39;good&#39;] = returns karma good<br />$memberContext[$user_info[&#39;id&#39;]][&#39;karma&#39;][&#39;bad&#39;] = returns karma bad<br />$memberContext[$user_info[&#39;id&#39;]][&#39;karma&#39;][&#39;allow&#39;] = returns whether user is allowed to edit the karma of another user<br /><br />$memberContext[$user_info[&#39;id&#39;]][&#39;ip&#39;] = returns ip,<br />$memberContext[$user_info[&#39;id&#39;]][&#39;ip2&#39;] = returns second formatted ip<br />$memberContext[$user_info[&#39;id&#39;]][&#39;online&#39;][&#39;is_online&#39;] = returns whether user is online or not<br />$memberContext[$user_info[&#39;id&#39;]][&#39;online&#39;][&#39;text&#39;] = returns online or offline depending on user status<br />$memberContext[$user_info[&#39;id&#39;]][&#39;online&#39;][&#39;href&#39;] = returns link to send user a new personal message<br />$memberContext[$user_info[&#39;id&#39;]][&#39;online&#39;][&#39;link&#39;] = returns online or offline with a link to a new personal message for that user.<br />$memberContext[$user_info[&#39;id&#39;]][&#39;online&#39;][&#39;image_href&#39;] = returns image for online/offline with link.<br />$memberContext[$user_info[&#39;id&#39;]][&#39;online&#39;][&#39;label&#39;] = returns "online" or "offline" again in text format depending on users status.<br /><br />$memberContext[$user_info[&#39;id&#39;]][&#39;language&#39;] = returns language user is using in their profile<br />$memberContext[$user_info[&#39;id&#39;]][&#39;is_activated&#39;] = returns whether user is active or not<br />$memberContext[$user_info[&#39;id&#39;]][&#39;is_banned&#39;] = returns whether user is banned or not<br />$memberContext[$user_info[&#39;id&#39;]][&#39;options&#39;] = returns profile options for that user<br />$memberContext[$user_info[&#39;id&#39;]][&#39;is_guest&#39;] = returns whether a user is a guest or not, but like using if (!user_info[&#39;id&#39;]) better.<br />$memberContext[$user_info[&#39;id&#39;]][&#39;group&#39;] = returns the usergroup that member belongs to.<br />$memberContext[$user_info[&#39;id&#39;]][&#39;group_color&#39;] = returns the color of the usergroup<br />$memberContext[$user_info[&#39;id&#39;]][&#39;group_id&#39;] = returns the id for that usergroup<br />$memberContext[$user_info[&#39;id&#39;]][&#39;post_group&#39;] = returns the post usergroup for that member.<br />$memberContext[$user_info[&#39;id&#39;]][&#39;post_group_color&#39;] = returns the color of the post usergroup for that member.<br />$memberContext[$user_info[&#39;id&#39;]][&#39;group_stars&#39;] = returns image of stars representing that usergroup<br />$memberContext[$user_info[&#39;id&#39;]][&#39;warning&#39;] = not sure about this 1, need to test on this, may give that user a warning, but not sure...<br />$memberContext[$user_info[&#39;id&#39;]][&#39;warning_status&#39;] = returns status of users warnings<br />$memberContext[$user_info[&#39;id&#39;]][&#39;local_time&#39;] = returns the users local time right now.


 

ด้วยฟังค์ชั่น ตอบด่วน คุณสามารถใช้โค๊ดและ เครื่องหมายแสดงอารมณ์ได้ เหมือนการตั้งกระทู้ธรรมดา แต่สามารถทำได้สะดวกกว่า

ระวัง: หัวข้อนี้ไม่มีการอัพเดทมานานถึง 120 วัน

แจ้งเตือน: โพสของคุณจะไม่แสดงจนกว่าผู้ดูแลจะอนุมัติ.
ชื่อ: อีเมล์: