$object = new myCRED_Rank();

Codex / mycred/rank / Objects / myCRED_Rank

Description

The rank object contains the rank post object, the set title, logo details, requirements and user count.

Available since version 1.7

Properties

Note that the constructor class will auto populate these values when the class is constructed.

Property Type Description
myCRED_Rank Object (
post_id int The rank post objects ID.
post obj The WordPress post object as returned by get_post.
title string The rank title.
minimum string or float The minimum point requirement set for this rank.
maximum string or float The maximum point requirement set for this rank.
count string The total number of users with this rank.
has_logo bool True if the rank has a logo attachment set or false if not.
logo_id int The numeric attachment ID set as the rank logo.
logo_url string The rank logo URL. This is the URL to the original file and not to cropped versions.
image_width int The set value for the MYCRED_RANK_WIDTH constant.
image_height int The set value for the MYCRED_RANK_HEIGHT constant.
point_type obj Holds the myCRED_Point_Type object with information about the point type associated with this balance.
)

Methods

Variable Type Required Description
class myCRED_Rank extends myCRED_Object {
function __construct( $rank_id = NULL ) {
$rank_id int Yes The rank post ID.
}
public function get_image( $image = 'logo' ) {
$image string No The image to return. Right now it only supports "logo".
}
}

Associated Functions

The rank object can be accessed via the mycred_get_rank function.

Object Example

myCRED_Rank Object
(
    [post_id] => 2140
    [post] => WP_Post Object
        (
            [ID] => 2140
            [post_author] => 1
            [post_date] => 2013-11-22 12:24:20
            [post_date_gmt] => 2013-11-22 11:24:20
            [post_content] => 
            [post_title] => Senior Member
            [post_excerpt] => 
            [post_status] => publish
            [comment_status] => closed
            [ping_status] => closed
            [post_password] => 
            [post_name] => senior-member
            [to_ping] => 
            [pinged] => 
            [post_modified] => 2014-05-22 00:39:05
            [post_modified_gmt] => 2014-05-21 22:39:05
            [post_content_filtered] => 
            [post_parent] => 0
            [guid] => http://website.com/?post_type=mycred_rank&p=2140
            [menu_order] => 0
            [post_type] => mycred_rank
            [post_mime_type] => 
            [comment_count] => 0
            [filter] => raw
        )

    [title] => Senior Member
    [minimum] => 1000
    [maximum] => 4999
    [count] => 1
    [has_logo] => 1
    [logo_id] => 6627
    [logo_url] => http://website.com/wp-content/uploads/2013/11/rank-three.png
    [image_width] => 250
    [image_height] => 250
    [point_type] => myCRED_Point_Type Object
        (
            [cred_id] => mycred_default
            [singular] => Token
            [plural] => Tokens
            [prefix] => 
            [suffix] => tk.
            [format] => Array
                (
                    [type] => bigint
                    [decimals] => 0
                    [separators] => Array
                        (
                            [decimal] => .
                            [thousand] => ,
                        )

                )

        )

)

Last edited June 23, 2016