{"id":9802,"date":"2013-04-11T14:05:19","date_gmt":"2013-04-11T14:05:19","guid":{"rendered":"http:\/\/musilda.cz\/?p=130"},"modified":"2013-04-11T14:05:19","modified_gmt":"2013-04-11T14:05:19","slug":"jak-zjistit-zda-je-uzivatel-prihlasen-ve-wordpress","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/jak-zjistit-zda-je-uzivatel-prihlasen-ve-wordpress\/","title":{"rendered":"Jak zjistit, zda je u\u017eivatel p\u0159ihl\u00e1\u0161en ve WordPress"},"content":{"rendered":"\n
N\u011bkdy pot\u0159ebujeme zjistit, zda je u\u017eivatel p\u0159ihl\u00e1\u0161en, nebo nikoliv. Pro to vyu\u017eijeme funkci is_user_logged_in(), kter\u00e1 vrac\u00ed True, nebo False. Pro lep\u0161\u00ed v\u00fdsledek zjist\u00edme login p\u0159ihl\u00e1\u0161en\u00e9ho usera, nebo zobraz\u00edme login a register link:<\/p>\n\n\n\n
if ( is_user_logged_in() ) {\nglobal $current_user;\nget_currentuserinfo();\necho '<\/pre>\n\n\n\nP\u0159ihl\u00e1\u0161en jako: ‚.$current_user->user_login.‘ „>Odhl\u00e1sit<\/a><\/p>\n\n\n\n
';\n} else {\necho '<\/pre>\n\n\n\nRegistrovat<\/a> P\u0159ihl\u00e1sit<\/a>‚; }<\/p>\n\n\n\n
Nezapomeneme tak\u00e9 na odhl\u00e1\u0161en\u00ed.<\/p>\n","protected":false},"excerpt":{"rendered":"
N\u011bkdy pot\u0159ebujeme zjistit, zda je u\u017eivatel p\u0159ihl\u00e1\u0161en, nebo nikoliv. Pro to vyu\u017eijeme funkci is_user_logged_in(), kter\u00e1 vrac\u00ed True, nebo False. Pro lep\u0161\u00ed v\u00fdsledek zjist\u00edme login p\u0159ihl\u00e1\u0161en\u00e9ho usera, nebo zobraz\u00edme login a register link: if ( is_user_logged_in() ) { global $current_user; get_currentuserinfo(); echo ‚ P\u0159ihl\u00e1\u0161en jako: ‚.$current_user->user_login.‘ „>Odhl\u00e1sit ‚; } else { echo ‚ Registrovat P\u0159ihl\u00e1sit‚; }<\/p>\n","protected":false},"author":1,"featured_media":8624,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,30],"tags":[],"class_list":["post-9802","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-snippety","category-wordpress"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/9802"}],"collection":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/comments?post=9802"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/9802\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/8624"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=9802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=9802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=9802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}