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

Moshi

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

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

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


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

โค๊ด: [Select]
require_once($sourcedir . '/Load.php');
      loadMemberData($user_info['id']);
      loadMemberContext($user_info['id']);

โค๊ด: [Select]
$memberContext[$user_info['id']]['username'] = gets users membername
$memberContext[$user_info['id']]['name'] = gets users real name
$memberContext[$user_info['id']]['id'] = gets users id, but better to just use $user_info['id'] instead
$memberContext[$user_info['id']]['is_buddy'] = returns whether or not user is buddy
$memberContext[$user_info['id']]['is_reverse_buddy'] = reverses the buddy list
$memberContext[$user_info['id']]['buddies'] = gets all buddies from that user
$memberContext[$user_info['id']]['title'] = gets the users title
$memberContext[$user_info['id']]['href'] = returns a link to that users profile only
$memberContext[$user_info['id']]['link'] = returns users name as a link to their profile
$memberContext[$user_info['id']]['email'] = gives you the users email address
$memberContext[$user_info['id']]['show_email'] = determines whether to show or hide that users email address
$memberContext[$user_info['id']]['registered'] = determines if a user is registered, if so, will return time and date when they registered, otherwise, Not Applicable text.
$memberContext[$user_info['id']]['registered_timestamp'] = returns date and time user registered
$memberContext[$user_info['id']]['blurb'] = returns the text that the user has typed into the Personal text area in their profile
$memberContext[$user_info['id']]['gender']['name'] = returns text whether user is male or female
$memberContext[$user_info['id']]['gender']['image'] = returns image representing either male of female of that user.

$memberContext[$user_info['id']]['website']['title'] = returns text for users website via their profile
$memberContext[$user_info['id']]['website']['url'] = returns href for users website via their profile

$memberContext[$user_info['id']]['birth_date'] = returns users Birthday as string
$memberContext[$user_info['id']]['signature'] = returns users signature via profile
$memberContext[$user_info['id']]['location'] = returns users location via profile

$memberContext[$user_info['id']]['icq']['name'] = returns icq name
$memberContext[$user_info['id']]['icq']['href'] = returns icq href
$memberContext[$user_info['id']]['icq']['link'] = returns name as a link to href with image for icq.
$memberContext[$user_info['id']]['icq']['link_text'] = returns name as a link to href without image for icq.

$memberContext[$user_info['id']]['aim']['name'] = returns aim name
$memberContext[$user_info['id']]['aim']['href'] = returns aim href
$memberContext[$user_info['id']]['aim']['link'] = returns name as a link to href with image for aim.
$memberContext[$user_info['id']]['aim']['link_text'] = returns name as a link to href without image for aim.

$memberContext[$user_info['id']]['yim']['name'] = returns yim name
$memberContext[$user_info['id']]['yim']['href'] = returns yim href
$memberContext[$user_info['id']]['yim']['link'] = returns name as a link to href with image for yim.
$memberContext[$user_info['id']]['yim']['link_text'] = returns name as a link to href without image for yim.

$memberContext[$user_info['id']]['msn']['name'] = returns msn name
$memberContext[$user_info['id']]['msn']['href'] = returns msn href
$memberContext[$user_info['id']]['msn']['link'] = returns name as a link to href with image for msn.
$memberContext[$user_info['id']]['msn']['link_text'] = returns name as a link to href without image for msn.

$memberContext[$user_info['id']]['real_posts'] = returns posts
$memberContext[$user_info['id']]['posts'] = returns posts a little differently
$memberContext[$user_info['id']]['avatar']['name'] = returns name of avatar
$memberContext[$user_info['id']]['avatar']['image'] = returns link of avatar image
$memberContext[$user_info['id']]['avatar']['href'] = returns name as a link to the avatar image
$memberContext[$user_info['id']]['avatar']['url'] = returns avatar url

$memberContext[$user_info['id']]['last_login'] = returns time/date of last login by that user.
$memberContext[$user_info['id']]['last_login_timestamp'] = returns last login timestamp by that user.
$memberContext[$user_info['id']]['karma']['good'] = returns karma good
$memberContext[$user_info['id']]['karma']['bad'] = returns karma bad
$memberContext[$user_info['id']]['karma']['allow'] = returns whether user is allowed to edit the karma of another user

$memberContext[$user_info['id']]['ip'] = returns ip,
$memberContext[$user_info['id']]['ip2'] = returns second formatted ip
$memberContext[$user_info['id']]['online']['is_online'] = returns whether user is online or not
$memberContext[$user_info['id']]['online']['text'] = returns online or offline depending on user status
$memberContext[$user_info['id']]['online']['href'] = returns link to send user a new personal message
$memberContext[$user_info['id']]['online']['link'] = returns online or offline with a link to a new personal message for that user.
$memberContext[$user_info['id']]['online']['image_href'] = returns image for online/offline with link.
$memberContext[$user_info['id']]['online']['label'] = returns "online" or "offline" again in text format depending on users status.

$memberContext[$user_info['id']]['language'] = returns language user is using in their profile
$memberContext[$user_info['id']]['is_activated'] = returns whether user is active or not
$memberContext[$user_info['id']]['is_banned'] = returns whether user is banned or not
$memberContext[$user_info['id']]['options'] = returns profile options for that user
$memberContext[$user_info['id']]['is_guest'] = returns whether a user is a guest or not, but like using if (!user_info['id']) better.
$memberContext[$user_info['id']]['group'] = returns the usergroup that member belongs to.
$memberContext[$user_info['id']]['group_color'] = returns the color of the usergroup
$memberContext[$user_info['id']]['group_id'] = returns the id for that usergroup
$memberContext[$user_info['id']]['post_group'] = returns the post usergroup for that member.
$memberContext[$user_info['id']]['post_group_color'] = returns the color of the post usergroup for that member.
$memberContext[$user_info['id']]['group_stars'] = returns image of stars representing that usergroup
$memberContext[$user_info['id']]['warning'] = not sure about this 1, need to test on this, may give that user a warning, but not sure...
$memberContext[$user_info['id']]['warning_status'] = returns status of users warnings
$memberContext[$user_info['id']]['local_time'] = returns the users local time right now.


 

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

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

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